1
Reply

What is the use of IDispose interface, destructors

Roy S

Roy S

Jan 7 2011 7:57 AM
2.6k
I have an abstract class called Shape which has a protected GraphicsPath that's used by the Graphics.DrawPath in the main class to draw the shape. There are also a few other classes that inherit Shape.

It all works but I found an option in vs2010 called 'run code analysis on ...' which tells me that I should implement the IDisposable interface because of that GraphicsPath. I did that but what exactly should I do in the Dispose method? Just grapicsPath.Dispose()?

Should the other classes also implement the interface if the base class already does?


And what about destructors? I have never used one, when are they needed?

Answers (1)