Long overdue (for me) question about disposing managed objects in .Net, VB.Net, C#
- by Jules
I can't believe I'm still confused about this but, any way, lets finally nail it:
I have a class that overrides OnPaint to do some drawing. To speed things up, I create the pens, brushes etc before hand, in the construtor, so that OnPaint does not need to keep creating and disposing them.
Now, I make sure that I always dispose of such objects, but I have the feeling I don't need to because, despite the fact they implement IDisposable, they're managed objects.
Is this correct?