George George

George George

  • NA
  • 778
  • 0

Types that own disposable fields should be disposable

Jun 17 2008 1:59 AM

Hello everyone,


For this best practices rule,

http://msdn.microsoft.com/en-us/ms182172.aspx

What are the benefits of following this rule even if I am not wrapping an unmanaged resource, like FileStream in the sample in the page.

I think it is fine if the class does not implement IDisposable, since FileStream could be disposed (to release the native file handle) since it has its own Dispose method. Any ideas?


thanks in advance,
George