Is it necessary to dispose of custom objects, even if they only contain managed objects? For example, I have a custom class that contains some List objects, as well as some string and xmldocument types. Should I create my own Dispose method (while NOT inheriting from IDisposable) and just clear those out to make sure they are empty? If I should, should I also inherit from IDisposable?
Share
Only when one or more of those managed objects inherits from IDisposable.
If you have IDisposable objects (aka managed resources) then implement IDisposable but do not add a destructor/finalizer.