What is the use of DISPOSE method

Q

What is the use of DISPOSE method?

✍: Guest

A

Dispose method belongs to IDisposable interface. We had seen in the previous section how bad it can be to override the finalize method for writing the cleaning of unmanaged resources. So if any object wants to release its unmanaged code best is to implement IDisposable and override the Dispose method of IDisposable interface. Now once your class has exposed the Dispose method itís the responsibility of the client to call the Dispose method to do the cleanup.

2007-10-23, 4779👍, 0💬