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!   } } 


C# in a Nutshell
C # in a Nutshell, Second Edition
ISBN: 0596005261
EAN: 2147483647
Year: 2005
Pages: 963

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net