title: Determine managed vs unmanaged resources
body: <p>There are lots of questions about managed vs unmanaged resources.  I understand the basic definition of the two.  However, I have a hard time knowing when a resource or object is managed or unmanaged.</p>
  
  <p>When I think of unmanaged resources I tend to think of native code that isn't directly part of .NET such as pinvoke or marshaling resources.  I would normally think of resources meant to interface to something that will use HW such as a file handle or network connection also being unmanaged.</p>
  
  <p>What about .NET objects that wrap native unmanaged resources such as a <code>FileStream</code>.</p>
  
  <p>A <code>FileStream</code> must use unmanaged resources, but when I implement the <code>IDisposable</code> pattern, should I consider this a managed or unmanaged resources?</p>
  
  <p>I've been assuming thus far that if the object implements <code>IDisposable</code>, then it is managed.  How would I know that <code>IntPtr</code> should be handled as an unmanaged resoruce?</p>