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! } }
Get C# in a Nutshell, 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.