6.2 StringBuilder Class
The StringBuilder class represents
mutable
strings. It starts at a predefined size (16 characters, by default)
and grows dynamically as more characters are added. It can grow
either unbounded or up to a configurable maximum. For example:
using System;
using System.Text;
class TestStringBuilder {
static void Main( ) {
StringBuilder sb = new StringBuilder("Hello, ");
sb.Append("World");
sb[11] = '!';
Console.WriteLine(sb); // Hello, World!
}
}
|