C# StringBuilder StringBuilder(String, Int32)

Description

StringBuilder StringBuilder(String, Int32) Initializes a new instance of the StringBuilder class using the specified string and capacity.

Syntax

StringBuilder.StringBuilder(String, Int32) has the following syntax.


public StringBuilder(
  string value,
  int capacity
)

Parameters

StringBuilder.StringBuilder(String, Int32) 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).
  • capacity - The suggested starting size of the StringBuilder.

Example


using System;//from   w w  w  .  j  av  a2s. c  o  m
using System.Text;

class Sample 
{
    public static void Main() 
    {
        int capacity = 255;
        StringBuilder stringBuilder = new StringBuilder("java2s.com",capacity);
    }
}




















Home »
  C# Tutorial »
    System.Text »




ASCIIEncoding
Encoding
EncodingInfo
StringBuilder
UnicodeEncoding
UTF8Encoding