I'm unclear about what classes need to implement IDisposable. Obviously those with unmanaged resources, but what about those with member variables that are IDisposable?
For example, if a class has a member variable that's a ManualResetEvent (which is IDisposable), does that class need to implement IDisposable so that it can call that ManualResetEvent's Dispose()?
If that class is IDisposable, its ManualResetEvent member's Dispose will be called when the class' Dispose() is called. However, if an object of that class isn't disposed of properly, its finalizer will call its Dispose(bool disposing) function, but that member's Dispose won't get called (because its a managed object). I assume that whatever unmanaged resources are used by ManualResetEvent are disposed of properly in its IDisposable implementation, even through its finalizer. My confusion, then, is whether there would be any benefit in making my class IDisposable, since I see no data leakage risk. Is the only benefit that unmanaged resources of its IDisposable members will be released a few milliseconds earlier?
Should IDisposable only be implemented in classes that directly hold unmanaged resources, and not in classes that don't directly hold unmanaged resources even if they have members that are themselves IDisposable?