- Object.Finalize() method releases unmanaged resources but don’t assure garbage collection. It is called before the Garbage Collector reclaims the memory. It is also called as a destructor, which is complementary to the constructor, where memory allocation happens.
public class MyClass {
~MyClass() {
// any custom release operations
}
}
- Dispose() method releases unmanaged resources from the object on which it is called. It is called when the implementing Disposable class is inside a using block.