What is IDisposable for?
Garbage collection is for memory. You need to dispose of non-memory resources – file handles, sockets, GDI+ handles, database connections etc. That’s typically what underlies an IDisposable type, although the actual handle can be quite a long way down a chain of references. For example, you might Dispose an XmlWriter which disposes a StreamWriter it … Read more