Sam,
Yes, that's pretty much what you have to do for any class that holds
onto a resource which requires Dispose called on it. It's not that much
extra code, really, it just seems like a lot. It's only about 30 lines, and
you can cut and paste it easily.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Sam Sungshik Kong" <ss*@chol.nospam.net> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hello!
I am creating a user control.
It draws something in OnPaint method every 0.5 second.
Instead of creating a Pen object and disposing it every time in the
method, I create a Pen object in the constructor and want to dispose it.
My question is what's the best way to dispose it?
Do I have to follow the "Implementing a Dispose Method" guide of MSDN?
It seems to be a lot of additional code.
TIA.
Sam