Re: Not disposing StringFormat?
- From: "Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 27 Jan 2008 17:49:45 +0100
Its good form to dispose of any object that you create if it is disposable. In the case of many GDI+ objects, StringFomat included, the System.Drawing classes are in fact nothing more than a wrapper around the unmanaged GDI+ library. This means that the management of unmanaged objects is important especially if you want good graphical performance.
--
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"JS" <jnospamster@xxxxxxxxx> wrote in message news:e0e125fd-f916-41ff-ad78-74397d8d230f@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks Bob. I hadn't noticed the static properties on StringFormat,
but it makes sense that you'd want to clone these before modifying.
I've always done a new StringFormat() and then set it up. The problem
was, I didn't notice that StringFormat was disposable (and the
Microsoft examples didn't help). It would be nice if Intellisense or
the VS editor highlighted the IDisposable objects somehow.
The current release of my software is not disposing some of these
objects -- I am guessing that there could be several thousand
StringFormat objects that I have not released because I found one of
them in the OnPaint of a UserControl that I wrote. I'm not sure how
serious of a problem this is.
.
- References:
- Not disposing StringFormat?
- From: JS
- Re: Not disposing StringFormat?
- From: Bob Powell [MVP]
- Re: Not disposing StringFormat?
- From: JS
- Not disposing StringFormat?
- Prev by Date: Re: Not disposing StringFormat?
- Next by Date: Re: how to printing multiple pages
- Previous by thread: Re: Not disposing StringFormat?
- Index(es):
Relevant Pages
|