16.10. Class StringBuilder

The String class provides many capabilities for processing Strings. However, a String’s contents can never change. Operations that seem to concatenate Strings are in fact creating new Strings (e.g., the &= operator creates a new String and assigns it to the String variable on the left side of the operator).

The next several sections discuss the features of class StringBuilder (namespace System.Text), used to create and manipulate dynamic string information—that is, mutable strings. Every StringBuilder can store the number of characters specified by its capacity. Exceeding the capacity of a StringBuilder makes the capacity expand to accommodate the additional characters. As we will see, members of class StringBuilder ...

Get Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.