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 c
Others have alluded to "using" blocks for GDI objects - here's a code example:
using( var bm = new Bitmap() )
using( var brush = new Brush() )
{
// code that uses the GDI objects goes here
...
} // objects are automatically disposed here, even if there's an exception
Note that you can have as many "using" lines as you want for a single code block.
I think this is a nice, clean way to deal with Disposable objects.