Garbage collector only cleans managed code and if any unmanaged code it finds it doesn’t reclaim its memory so to remove unused objects we need something. In this case, at least we have a responsibility to call these kinds of which free unmanaged code objects. In C# application there is a place where we can manage these unmanaged objects and this place is a destructor.
But in Garbage collection destructor creates some problem which we solve by using an IDisposable Dispose pattern....
What is Idisposable interface and Finalize Dispose pattern?
But in Garbage collection destructor creates some problem which we solve by using an IDisposable Dispose pattern....
What is Idisposable interface and Finalize Dispose pattern?