[CoMoDev] Re: Garbage collection

  • From: "dick_grier Grier" <dick_grier@xxxxxxx>
  • To: comodev@xxxxxxxxxxxxx
  • Date: Thu, 18 Aug 2005 10:55:14 -0600

Hi Andrei,

In general, I agree with Darren. I use StringBuilder when concatenating, with one exception (and this can be important, IMO).

The exception is when you must parse the resultant string (for whaterver reason), immediately after concatenation. If you have to parse, you must convert the StringBuilder object to a String, and the result is that the use of the StringBuilder actually can incure a performance penalty (especially if the parsing process involve creation of multiple substrings). However, if the job simply involves appending new data, and perhaps occasional cleanup, then StringBuilder is the way to go.


Richard Grier (Microsoft MVP - Visual Basic)
Hard & Software
12962 West Louisiana Avenue
Lakewood, CO  80228
303-986-2179 (voice)
303-593-9315 (fax)

Author of Visual Basic Programmer's Guide to Serial Communications, 4th Edition ISBN 1-890422-28-2 (391 pages) published July 2004. For faster service, contact the publisher at http://www.mabry.com/vbpgser4.

Other related posts: