C# StringBuilder StringBuilder(String)

Description

StringBuilder StringBuilder(String) Initializes a new instance of the StringBuilder class using the specified string.

Syntax

StringBuilder.StringBuilder(String) has the following syntax.


public StringBuilder(
  string value
)

Parameters

StringBuilder.StringBuilder(String) has the following parameters.

  • value - The string used to initialize the value of the instance. If value is null, the new StringBuilder will contain the empty string (that is, it contains Empty).

Example


//from   w  ww  . j  ava 2 s  . c om

using System;
using System.Text;

class Sample 
{
    public static void Main() 
    {
        StringBuilder sb1 = new StringBuilder("abc");
        Console.WriteLine(sb1.Capacity);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Text »




ASCIIEncoding
Encoding
EncodingInfo
StringBuilder
UnicodeEncoding
UTF8Encoding