What's the purpose of implementing the IDisposable interface? I've seen some classes implementing it and I don't understand why.
C# IDisposable – Purpose of Implementing the IDisposable Interface
c++idisposable
c++idisposable
What's the purpose of implementing the IDisposable interface? I've seen some classes implementing it and I don't understand why.
Best Answer
If your class creates unmanaged resources, then you can implement IDisposable so that these resources will be cleaned up properly when the object is disposed of. You override Dispose and release them there.