mscorlib(4.0.0.0) API with additions
System.Text.StringBuilder Class Reference

Represents a mutable string of characters. This class cannot be inherited.To browse the .NET Framework source code for this type, see the Reference Source. More...

Inheritance diagram for System.Text.StringBuilder:
[legend]
Collaboration diagram for System.Text.StringBuilder:
[legend]

Public Member Functions

 StringBuilder ()
 Initializes a new instance of the T:System.Text.StringBuilder class. More...
 
 StringBuilder (int capacity)
 Initializes a new instance of the T:System.Text.StringBuilder class using the specified capacity. More...
 
 StringBuilder (string value)
 Initializes a new instance of the T:System.Text.StringBuilder class using the specified string. More...
 
 StringBuilder??? (string value, int capacity)
 Initializes a new instance of the T:System.Text.StringBuilder class using the specified string and capacity. More...
 
unsafe StringBuilder (string value, int startIndex, int length, int capacity)
 Initializes a new instance of the T:System.Text.StringBuilder class from the specified substring and capacity. More...
 
 StringBuilder (int capacity, int maxCapacity)
 Initializes a new instance of the T:System.Text.StringBuilder class that starts with a specified capacity and can grow to a specified maximum. More...
 
int EnsureCapacity (int capacity)
 Ensures that the capacity of this instance of T:System.Text.StringBuilder is at least the specified value. More...
 
unsafe override string ToString ()
 Converts the value of this instance to a T:System.String. More...
 
unsafe string ToString (int startIndex, int length)
 Converts the value of a substring of this instance to a T:System.String. More...
 
StringBuilder Clear ()
 Removes all characters from the current T:System.Text.StringBuilder instance. More...
 
StringBuilder Append (char value, int repeatCount)
 Appends a specified number of copies of the string representation of a Unicode character to this instance. More...
 
unsafe StringBuilder Append (char[] value, int startIndex, int charCount)
 Appends the string representation of a specified subarray of Unicode characters to this instance. More...
 
unsafe StringBuilder Append (string value)
 Appends a copy of the specified string to this instance. More...
 
unsafe StringBuilder Append (string value, int startIndex, int count)
 Appends a copy of a specified substring to this instance. More...
 
StringBuilder AppendLine ()
 Appends the default line terminator to the end of the current T:System.Text.StringBuilder object. More...
 
StringBuilder AppendLine (string value)
 Appends a copy of the specified string followed by the default line terminator to the end of the current T:System.Text.StringBuilder object. More...
 
void CopyTo (int sourceIndex, char[] destination, int destinationIndex, int count)
 Copies the characters from a specified segment of this instance to a specified segment of a destination T:System.Char array. More...
 
unsafe StringBuilder Insert (int index, string value, int count)
 Inserts one or more copies of a specified string into this instance at the specified character position. More...
 
StringBuilder Remove (int startIndex, int length)
 Removes the specified range of characters from this instance. More...
 
StringBuilder Append (bool value)
 Appends the string representation of a specified Boolean value to this instance. More...
 
StringBuilder Append (sbyte value)
 Appends the string representation of a specified 8-bit signed integer to this instance. More...
 
StringBuilder Append (byte value)
 Appends the string representation of a specified 8-bit unsigned integer to this instance. More...
 
StringBuilder Append (char value)
 Appends the string representation of a specified T:System.Char object to this instance. More...
 
StringBuilder Append (short value)
 Appends the string representation of a specified 16-bit signed integer to this instance. More...
 
StringBuilder Append (int value)
 Appends the string representation of a specified 32-bit signed integer to this instance. More...
 
StringBuilder Append (long value)
 Appends the string representation of a specified 64-bit signed integer to this instance. More...
 
StringBuilder Append (float value)
 Appends the string representation of a specified single-precision floating-point number to this instance. More...
 
StringBuilder Append (double value)
 Appends the string representation of a specified double-precision floating-point number to this instance. More...
 
StringBuilder Append (decimal value)
 Appends the string representation of a specified decimal number to this instance. More...
 
StringBuilder Append (ushort value)
 Appends the string representation of a specified 16-bit unsigned integer to this instance. More...
 
StringBuilder Append (uint value)
 Appends the string representation of a specified 32-bit unsigned integer to this instance. More...
 
StringBuilder Append (ulong value)
 Appends the string representation of a specified 64-bit unsigned integer to this instance. More...
 
StringBuilder Append (object value)
 Appends the string representation of a specified object to this instance. More...
 
unsafe StringBuilder Append (char[] value)
 Appends the string representation of the Unicode characters in a specified array to this instance. More...
 
unsafe StringBuilder Insert (int index, string value)
 Inserts a string into this instance at the specified character position. More...
 
StringBuilder Insert (int index, bool value)
 Inserts the string representation of a Boolean value into this instance at the specified character position. More...
 
StringBuilder Insert (int index, sbyte value)
 Inserts the string representation of a specified 8-bit signed integer into this instance at the specified character position. More...
 
StringBuilder Insert (int index, byte value)
 Inserts the string representation of a specified 8-bit unsigned integer into this instance at the specified character position. More...
 
StringBuilder Insert (int index, short value)
 Inserts the string representation of a specified 16-bit signed integer into this instance at the specified character position. More...
 
unsafe StringBuilder Insert (int index, char value)
 Inserts the string representation of a specified Unicode character into this instance at the specified character position. More...
 
StringBuilder Insert (int index, char[] value)
 Inserts the string representation of a specified array of Unicode characters into this instance at the specified character position. More...
 
unsafe StringBuilder Insert (int index, char[] value, int startIndex, int charCount)
 Inserts the string representation of a specified subarray of Unicode characters into this instance at the specified character position. More...
 
StringBuilder Insert (int index, int value)
 Inserts the string representation of a specified 32-bit signed integer into this instance at the specified character position. More...
 
StringBuilder Insert (int index, long value)
 Inserts the string representation of a 64-bit signed integer into this instance at the specified character position. More...
 
StringBuilder Insert (int index, float value)
 Inserts the string representation of a single-precision floating point number into this instance at the specified character position. More...
 
StringBuilder Insert (int index, double value)
 Inserts the string representation of a double-precision floating-point number into this instance at the specified character position. More...
 
StringBuilder Insert (int index, decimal value)
 Inserts the string representation of a decimal number into this instance at the specified character position. More...
 
StringBuilder Insert (int index, ushort value)
 Inserts the string representation of a 16-bit unsigned integer into this instance at the specified character position. More...
 
StringBuilder Insert (int index, uint value)
 Inserts the string representation of a 32-bit unsigned integer into this instance at the specified character position. More...
 
StringBuilder Insert (int index, ulong value)
 Inserts the string representation of a 64-bit unsigned integer into this instance at the specified character position. More...
 
StringBuilder Insert (int index, object value)
 Inserts the string representation of an object into this instance at the specified character position. More...
 
StringBuilder AppendFormat (string format, object arg0)
 Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a single argument. More...
 
StringBuilder AppendFormat (string format, object arg0, object arg1)
 Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of either of two arguments. More...
 
StringBuilder AppendFormat (string format, object arg0, object arg1, object arg2)
 Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of either of three arguments. More...
 
StringBuilder AppendFormat (string format, params object[] args)
 Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a corresponding argument in a parameter array. More...
 
StringBuilder AppendFormat (IFormatProvider provider, string format, object arg0)
 Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a single argument using a specified format provider. More...
 
StringBuilder AppendFormat (IFormatProvider provider, string format, object arg0, object arg1)
 Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of either of two arguments using a specified format provider. More...
 
StringBuilder AppendFormat (IFormatProvider provider, string format, object arg0, object arg1, object arg2)
 Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of either of three arguments using a specified format provider. More...
 
StringBuilder AppendFormat (IFormatProvider provider, string format, params object[] args)
 Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a corresponding argument in a parameter array using a specified format provider. More...
 
StringBuilder Replace (string oldValue, string newValue)
 Replaces all occurrences of a specified string in this instance with another specified string. More...
 
bool Equals (StringBuilder sb)
 Returns a value indicating whether this instance is equal to a specified object. More...
 
StringBuilder Replace (string oldValue, string newValue, int startIndex, int count)
 Replaces, within a substring of this instance, all occurrences of a specified string with another specified string. More...
 
StringBuilder Replace (char oldChar, char newChar)
 Replaces all occurrences of a specified character in this instance with another specified character. More...
 
StringBuilder Replace (char oldChar, char newChar, int startIndex, int count)
 Replaces, within a substring of this instance, all occurrences of a specified character with another specified character. More...
 
unsafe StringBuilder Append (char *value, int valueCount)
 Appends an array of Unicode characters starting at a specified address to this instance. More...
 

Properties

int Capacity [get, set]
 Gets or sets the maximum number of characters that can be contained in the memory allocated by the current instance. More...
 
int MaxCapacity [get]
 Gets the maximum capacity of this instance. More...
 
int Length [get, set]
 Gets or sets the length of the current T:System.Text.StringBuilder object. More...
 
char this[int index] [get, set]
 Gets or sets the character at the specified character position in this instance. More...
 

Detailed Description

Represents a mutable string of characters. This class cannot be inherited.To browse the .NET Framework source code for this type, see the Reference Source.

Definition at line 14 of file StringBuilder.cs.

Constructor & Destructor Documentation

◆ StringBuilder() [1/5]

System.Text.StringBuilder.StringBuilder ( )

Initializes a new instance of the T:System.Text.StringBuilder class.

Definition at line 191 of file StringBuilder.cs.

◆ StringBuilder() [2/5]

System.Text.StringBuilder.StringBuilder ( int  capacity)

Initializes a new instance of the T:System.Text.StringBuilder class using the specified capacity.

Parameters
capacityThe suggested starting size of this instance.
Exceptions
T:System.ArgumentOutOfRangeExceptioncapacity is less than zero.

Definition at line 201 of file StringBuilder.cs.

◆ StringBuilder() [3/5]

System.Text.StringBuilder.StringBuilder ( string  value)

Initializes a new instance of the T:System.Text.StringBuilder class using the specified string.

Parameters
valueThe string used to initialize the value of the instance. If value is null, the new T:System.Text.StringBuilder will contain the empty string (that is, it contains F:System.String.Empty).

Definition at line 209 of file StringBuilder.cs.

◆ StringBuilder() [4/5]

unsafe System.Text.StringBuilder.StringBuilder ( string  value,
int  startIndex,
int  length,
int  capacity 
)

Initializes a new instance of the T:System.Text.StringBuilder class from the specified substring and capacity.

Parameters
valueThe string that contains the substring used to initialize the value of this instance. If value is null, the new T:System.Text.StringBuilder will contain the empty string (that is, it contains F:System.String.Empty).
startIndexThe position within value where the substring begins.
lengthThe number of characters in the substring.
capacityThe suggested starting size of the T:System.Text.StringBuilder.
Exceptions
T:System.ArgumentOutOfRangeExceptioncapacity is less than zero.-or- startIndex plus length is not a position within value .

Definition at line 235 of file StringBuilder.cs.

◆ StringBuilder() [5/5]

System.Text.StringBuilder.StringBuilder ( int  capacity,
int  maxCapacity 
)

Initializes a new instance of the T:System.Text.StringBuilder class that starts with a specified capacity and can grow to a specified maximum.

Parameters
capacityThe suggested starting size of the T:System.Text.StringBuilder.
maxCapacityThe maximum number of characters the current string can contain.
Exceptions
T:System.ArgumentOutOfRangeExceptionmaxCapacity is less than one, capacity is less than zero, or capacity is greater than maxCapacity .

Definition at line 280 of file StringBuilder.cs.

Member Function Documentation

◆ Append() [1/20]

StringBuilder System.Text.StringBuilder.Append ( char  value,
int  repeatCount 
)

Appends a specified number of copies of the string representation of a Unicode character to this instance.

Parameters
valueThe character to append.
repeatCountThe number of times to append value .
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionrepeatCount is less than zero.-or- Enlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.
T:System.OutOfMemoryExceptionOut of memory.

Definition at line 540 of file StringBuilder.cs.

◆ Append() [2/20]

unsafe StringBuilder System.Text.StringBuilder.Append ( char []  value,
int  startIndex,
int  charCount 
)

Appends the string representation of a specified subarray of Unicode characters to this instance.

Parameters
valueA character array.
startIndexThe starting position in value .
charCountThe number of characters to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentNullExceptionvalue is null, and startIndex and charCount are not zero.
T:System.ArgumentOutOfRangeExceptioncharCount is less than zero.-or- startIndex is less than zero.-or- startIndex + charCount is greater than the length of value .-or- Enlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 582 of file StringBuilder.cs.

◆ Append() [3/20]

unsafe StringBuilder System.Text.StringBuilder.Append ( string  value)

Appends a copy of the specified string to this instance.

Parameters
valueThe string to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 625 of file StringBuilder.cs.

◆ Append() [4/20]

unsafe StringBuilder System.Text.StringBuilder.Append ( string  value,
int  startIndex,
int  count 
)

Appends a copy of a specified substring to this instance.

Parameters
valueThe string that contains the substring to append.
startIndexThe starting position of the substring within value .
countThe number of characters in value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentNullExceptionvalue is null, and startIndex and count are not zero.
T:System.ArgumentOutOfRangeExceptioncount less than zero.-or- startIndex less than zero.-or- startIndex + count is greater than the length of value .-or- Enlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 696 of file StringBuilder.cs.

◆ Append() [5/20]

StringBuilder System.Text.StringBuilder.Append ( bool  value)

Appends the string representation of a specified Boolean value to this instance.

Parameters
valueThe Boolean value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 904 of file StringBuilder.cs.

◆ Append() [6/20]

StringBuilder System.Text.StringBuilder.Append ( sbyte  value)

Appends the string representation of a specified 8-bit signed integer to this instance.

Parameters
valueThe value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 915 of file StringBuilder.cs.

◆ Append() [7/20]

StringBuilder System.Text.StringBuilder.Append ( byte  value)

Appends the string representation of a specified 8-bit unsigned integer to this instance.

Parameters
valueThe value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 925 of file StringBuilder.cs.

◆ Append() [8/20]

StringBuilder System.Text.StringBuilder.Append ( char  value)

Appends the string representation of a specified T:System.Char object to this instance.

Parameters
valueThe UTF-16-encoded code unit to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 935 of file StringBuilder.cs.

◆ Append() [9/20]

StringBuilder System.Text.StringBuilder.Append ( short  value)

Appends the string representation of a specified 16-bit signed integer to this instance.

Parameters
valueThe value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 953 of file StringBuilder.cs.

◆ Append() [10/20]

StringBuilder System.Text.StringBuilder.Append ( int  value)

Appends the string representation of a specified 32-bit signed integer to this instance.

Parameters
valueThe value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 963 of file StringBuilder.cs.

◆ Append() [11/20]

StringBuilder System.Text.StringBuilder.Append ( long  value)

Appends the string representation of a specified 64-bit signed integer to this instance.

Parameters
valueThe value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 973 of file StringBuilder.cs.

◆ Append() [12/20]

StringBuilder System.Text.StringBuilder.Append ( float  value)

Appends the string representation of a specified single-precision floating-point number to this instance.

Parameters
valueThe value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 983 of file StringBuilder.cs.

◆ Append() [13/20]

StringBuilder System.Text.StringBuilder.Append ( double  value)

Appends the string representation of a specified double-precision floating-point number to this instance.

Parameters
valueThe value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 993 of file StringBuilder.cs.

◆ Append() [14/20]

StringBuilder System.Text.StringBuilder.Append ( decimal  value)

Appends the string representation of a specified decimal number to this instance.

Parameters
valueThe value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1003 of file StringBuilder.cs.

◆ Append() [15/20]

StringBuilder System.Text.StringBuilder.Append ( ushort  value)

Appends the string representation of a specified 16-bit unsigned integer to this instance.

Parameters
valueThe value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1014 of file StringBuilder.cs.

◆ Append() [16/20]

StringBuilder System.Text.StringBuilder.Append ( uint  value)

Appends the string representation of a specified 32-bit unsigned integer to this instance.

Parameters
valueThe value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1025 of file StringBuilder.cs.

◆ Append() [17/20]

StringBuilder System.Text.StringBuilder.Append ( ulong  value)

Appends the string representation of a specified 64-bit unsigned integer to this instance.

Parameters
valueThe value to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1036 of file StringBuilder.cs.

◆ Append() [18/20]

StringBuilder System.Text.StringBuilder.Append ( object  value)

Appends the string representation of a specified object to this instance.

Parameters
valueThe object to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1046 of file StringBuilder.cs.

◆ Append() [19/20]

unsafe StringBuilder System.Text.StringBuilder.Append ( char []  value)

Appends the string representation of the Unicode characters in a specified array to this instance.

Parameters
valueThe array of characters to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1061 of file StringBuilder.cs.

◆ Append() [20/20]

unsafe StringBuilder System.Text.StringBuilder.Append ( char *  value,
int  valueCount 
)

Appends an array of Unicode characters starting at a specified address to this instance.

Parameters
valueA pointer to an array of characters.
valueCountThe number of characters in the array.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionvalueCount is less than zero. -or-Enlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.
T:System.NullReferenceExceptionvalue is a null pointer.

Definition at line 1932 of file StringBuilder.cs.

◆ AppendFormat() [1/8]

StringBuilder System.Text.StringBuilder.AppendFormat ( string  format,
object  arg0 
)

Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a single argument.

Parameters
formatA composite format string (see Remarks).
arg0An object to format.
Returns
A reference to this instance with format appended. Each format item in format is replaced by the string representation of arg0 .
Exceptions
T:System.ArgumentNullExceptionformat is null.
T:System.FormatExceptionformat is invalid. -or-The index of a format item is less than 0 (zero), or greater than or equal to 1.
T:System.ArgumentOutOfRangeExceptionThe length of the expanded string would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1369 of file StringBuilder.cs.

◆ AppendFormat() [2/8]

StringBuilder System.Text.StringBuilder.AppendFormat ( string  format,
object  arg0,
object  arg1 
)

Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of either of two arguments.

Parameters
formatA composite format string (see Remarks).
arg0The first object to format.
arg1The second object to format.
Returns
A reference to this instance with format appended. Each format item in format is replaced by the string representation of the corresponding object argument.
Exceptions
T:System.ArgumentNullExceptionformat is null.
T:System.FormatExceptionformat is invalid.-or-The index of a format item is less than 0 (zero), or greater than or equal to 2.
T:System.ArgumentOutOfRangeExceptionThe length of the expanded string would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1385 of file StringBuilder.cs.

◆ AppendFormat() [3/8]

StringBuilder System.Text.StringBuilder.AppendFormat ( string  format,
object  arg0,
object  arg1,
object  arg2 
)

Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of either of three arguments.

Parameters
formatA composite format string (see Remarks).
arg0The first object to format.
arg1The second object to format.
arg2The third object to format.
Returns
A reference to this instance with format appended. Each format item in format is replaced by the string representation of the corresponding object argument.
Exceptions
T:System.ArgumentNullExceptionformat is null.
T:System.FormatExceptionformat is invalid.-or-The index of a format item is less than 0 (zero), or greater than or equal to 3.
T:System.ArgumentOutOfRangeExceptionThe length of the expanded string would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1402 of file StringBuilder.cs.

◆ AppendFormat() [4/8]

StringBuilder System.Text.StringBuilder.AppendFormat ( string  format,
params object []  args 
)

Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a corresponding argument in a parameter array.

Parameters
formatA composite format string (see Remarks).
argsAn array of objects to format.
Returns
A reference to this instance with format appended. Each format item in format is replaced by the string representation of the corresponding object argument.
Exceptions
T:System.ArgumentNullExceptionformat or args is null.
T:System.FormatExceptionformat is invalid. -or-The index of a format item is less than 0 (zero), or greater than or equal to the length of the args array.
T:System.ArgumentOutOfRangeExceptionThe length of the expanded string would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1417 of file StringBuilder.cs.

◆ AppendFormat() [5/8]

StringBuilder System.Text.StringBuilder.AppendFormat ( IFormatProvider  provider,
string  format,
object  arg0 
)

Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a single argument using a specified format provider.

Parameters
providerAn object that supplies culture-specific formatting information.
formatA composite format string (see Remarks).
arg0The object to format.
Returns
A reference to this instance after the append operation has completed. After the append operation, this instance contains any data that existed before the operation, suffixed by a copy of format in which any format specification is replaced by the string representation of arg0 .
Exceptions
T:System.ArgumentNullExceptionformat is null.
T:System.FormatExceptionformat is invalid. -or-The index of a format item is less than 0 (zero), or greater than or equal to one (1).
T:System.ArgumentOutOfRangeExceptionThe length of the expanded string would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1437 of file StringBuilder.cs.

◆ AppendFormat() [6/8]

StringBuilder System.Text.StringBuilder.AppendFormat ( IFormatProvider  provider,
string  format,
object  arg0,
object  arg1 
)

Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of either of two arguments using a specified format provider.

Parameters
providerAn object that supplies culture-specific formatting information.
formatA composite format string (see Remarks).
arg0The first object to format.
arg1The second object to format.
Returns
A reference to this instance after the append operation has completed. After the append operation, this instance contains any data that existed before the operation, suffixed by a copy of format where any format specification is replaced by the string representation of the corresponding object argument.
Exceptions
T:System.ArgumentNullExceptionformat is null.
T:System.FormatExceptionformat is invalid. -or-The index of a format item is less than 0 (zero), or greater than or equal to 2 (two).
T:System.ArgumentOutOfRangeExceptionThe length of the expanded string would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1454 of file StringBuilder.cs.

◆ AppendFormat() [7/8]

StringBuilder System.Text.StringBuilder.AppendFormat ( IFormatProvider  provider,
string  format,
object  arg0,
object  arg1,
object  arg2 
)

Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of either of three arguments using a specified format provider.

Parameters
providerAn object that supplies culture-specific formatting information.
formatA composite format string (see Remarks).
arg0The first object to format.
arg1The second object to format.
arg2The third object to format.
Returns
A reference to this instance after the append operation has completed. After the append operation, this instance contains any data that existed before the operation, suffixed by a copy of format where any format specification is replaced by the string representation of the corresponding object argument.
Exceptions
T:System.ArgumentNullExceptionformat is null.
T:System.FormatExceptionformat is invalid. -or-The index of a format item is less than 0 (zero), or greater than or equal to 3 (three).
T:System.ArgumentOutOfRangeExceptionThe length of the expanded string would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1472 of file StringBuilder.cs.

◆ AppendFormat() [8/8]

StringBuilder System.Text.StringBuilder.AppendFormat ( IFormatProvider  provider,
string  format,
params object []  args 
)

Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a corresponding argument in a parameter array using a specified format provider.

Parameters
providerAn object that supplies culture-specific formatting information.
formatA composite format string (see Remarks).
argsAn array of objects to format.
Returns
A reference to this instance after the append operation has completed. After the append operation, this instance contains any data that existed before the operation, suffixed by a copy of format where any format specification is replaced by the string representation of the corresponding object argument.
Exceptions
T:System.ArgumentNullExceptionformat is null.
T:System.FormatExceptionformat is invalid. -or-The index of a format item is less than 0 (zero), or greater than or equal to the length of the args array.
T:System.ArgumentOutOfRangeExceptionThe length of the expanded string would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1488 of file StringBuilder.cs.

◆ AppendLine() [1/2]

StringBuilder System.Text.StringBuilder.AppendLine ( )

Appends the default line terminator to the end of the current T:System.Text.StringBuilder object.

Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 738 of file StringBuilder.cs.

◆ AppendLine() [2/2]

StringBuilder System.Text.StringBuilder.AppendLine ( string  value)

Appends a copy of the specified string followed by the default line terminator to the end of the current T:System.Text.StringBuilder object.

Parameters
valueThe string to append.
Returns
A reference to this instance after the append operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 749 of file StringBuilder.cs.

◆ Clear()

StringBuilder System.Text.StringBuilder.Clear ( )

Removes all characters from the current T:System.Text.StringBuilder instance.

Returns
An object whose P:System.Text.StringBuilder.Length is 0 (zero).

Definition at line 526 of file StringBuilder.cs.

◆ CopyTo()

void System.Text.StringBuilder.CopyTo ( int  sourceIndex,
char []  destination,
int  destinationIndex,
int  count 
)

Copies the characters from a specified segment of this instance to a specified segment of a destination T:System.Char array.

Parameters
sourceIndexThe starting position in this instance where characters will be copied from. The index is zero-based.
destinationThe array where characters will be copied.
destinationIndexThe starting position in destination where characters will be copied. The index is zero-based.
countThe number of characters to be copied.
Exceptions
T:System.ArgumentNullExceptiondestination is null.
T:System.ArgumentOutOfRangeExceptionsourceIndex , destinationIndex , or count , is less than zero.-or- sourceIndex is greater than the length of this instance.
T:System.ArgumentExceptionsourceIndex + count is greater than the length of this instance.-or- destinationIndex + count is greater than the length of destination .

Definition at line 771 of file StringBuilder.cs.

◆ EnsureCapacity()

int System.Text.StringBuilder.EnsureCapacity ( int  capacity)

Ensures that the capacity of this instance of T:System.Text.StringBuilder is at least the specified value.

Parameters
capacityThe minimum capacity to ensure.
Returns
The new capacity of this instance.
Exceptions
T:System.ArgumentOutOfRangeExceptioncapacity is less than zero.-or- Enlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 402 of file StringBuilder.cs.

◆ Equals()

bool System.Text.StringBuilder.Equals ( StringBuilder  sb)

Returns a value indicating whether this instance is equal to a specified object.

Parameters
sbAn object to compare with this instance, or null.
Returns
true if this instance and sb have equal string, P:System.Text.StringBuilder.Capacity, and P:System.Text.StringBuilder.MaxCapacity values; otherwise, false.

Definition at line 1733 of file StringBuilder.cs.

◆ Insert() [1/18]

unsafe StringBuilder System.Text.StringBuilder.Insert ( int  index,
string  value,
int  count 
)

Inserts one or more copies of a specified string into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe string to insert.
countThe number of times to insert value .
Returns
A reference to this instance after insertion has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the current length of this instance.-or- count is less than zero.
T:System.OutOfMemoryExceptionThe current length of this T:System.Text.StringBuilder object plus the length of value times count exceeds P:System.Text.StringBuilder.MaxCapacity.

Definition at line 835 of file StringBuilder.cs.

◆ Insert() [2/18]

unsafe StringBuilder System.Text.StringBuilder.Insert ( int  index,
string  value 
)

Inserts a string into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe string to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the current length of this instance. -or-The current length of this T:System.Text.StringBuilder object plus the length of value exceeds P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1081 of file StringBuilder.cs.

◆ Insert() [3/18]

StringBuilder System.Text.StringBuilder.Insert ( int  index,
bool  value 
)

Inserts the string representation of a Boolean value into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.
T:System.OutOfMemoryExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1105 of file StringBuilder.cs.

◆ Insert() [4/18]

StringBuilder System.Text.StringBuilder.Insert ( int  index,
sbyte  value 
)

Inserts the string representation of a specified 8-bit signed integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.
T:System.OutOfMemoryExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1119 of file StringBuilder.cs.

◆ Insert() [5/18]

StringBuilder System.Text.StringBuilder.Insert ( int  index,
byte  value 
)

Inserts the string representation of a specified 8-bit unsigned integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.
T:System.OutOfMemoryExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1132 of file StringBuilder.cs.

◆ Insert() [6/18]

StringBuilder System.Text.StringBuilder.Insert ( int  index,
short  value 
)

Inserts the string representation of a specified 16-bit signed integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.
T:System.OutOfMemoryExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1145 of file StringBuilder.cs.

◆ Insert() [7/18]

unsafe StringBuilder System.Text.StringBuilder.Insert ( int  index,
char  value 
)

Inserts the string representation of a specified Unicode character into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1158 of file StringBuilder.cs.

◆ Insert() [8/18]

StringBuilder System.Text.StringBuilder.Insert ( int  index,
char []  value 
)

Inserts the string representation of a specified array of Unicode characters into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe character array to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1171 of file StringBuilder.cs.

◆ Insert() [9/18]

unsafe StringBuilder System.Text.StringBuilder.Insert ( int  index,
char []  value,
int  startIndex,
int  charCount 
)

Inserts the string representation of a specified subarray of Unicode characters into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueA character array.
startIndexThe starting index within value .
charCountThe number of characters to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentNullExceptionvalue is null, and startIndex and charCount are not zero.
T:System.ArgumentOutOfRangeExceptionindex , startIndex , or charCount is less than zero.-or- index is greater than the length of this instance.-or- startIndex plus charCount is not a position within value .-or- Enlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1198 of file StringBuilder.cs.

◆ Insert() [10/18]

StringBuilder System.Text.StringBuilder.Insert ( int  index,
int  value 
)

Inserts the string representation of a specified 32-bit signed integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.
T:System.OutOfMemoryExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1243 of file StringBuilder.cs.

◆ Insert() [11/18]

StringBuilder System.Text.StringBuilder.Insert ( int  index,
long  value 
)

Inserts the string representation of a 64-bit signed integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.
T:System.OutOfMemoryExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1256 of file StringBuilder.cs.

◆ Insert() [12/18]

StringBuilder System.Text.StringBuilder.Insert ( int  index,
float  value 
)

Inserts the string representation of a single-precision floating point number into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.
T:System.OutOfMemoryExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1269 of file StringBuilder.cs.

◆ Insert() [13/18]

StringBuilder System.Text.StringBuilder.Insert ( int  index,
double  value 
)

Inserts the string representation of a double-precision floating-point number into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.
T:System.OutOfMemoryExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1282 of file StringBuilder.cs.

◆ Insert() [14/18]

StringBuilder System.Text.StringBuilder.Insert ( int  index,
decimal  value 
)

Inserts the string representation of a decimal number into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.
T:System.OutOfMemoryExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1295 of file StringBuilder.cs.

◆ Insert() [15/18]

StringBuilder System.Text.StringBuilder.Insert ( int  index,
ushort  value 
)

Inserts the string representation of a 16-bit unsigned integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.
T:System.OutOfMemoryExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1309 of file StringBuilder.cs.

◆ Insert() [16/18]

StringBuilder System.Text.StringBuilder.Insert ( int  index,
uint  value 
)

Inserts the string representation of a 32-bit unsigned integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.
T:System.OutOfMemoryExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1323 of file StringBuilder.cs.

◆ Insert() [17/18]

StringBuilder System.Text.StringBuilder.Insert ( int  index,
ulong  value 
)

Inserts the string representation of a 64-bit unsigned integer into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe value to insert.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.
T:System.OutOfMemoryExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1337 of file StringBuilder.cs.

◆ Insert() [18/18]

StringBuilder System.Text.StringBuilder.Insert ( int  index,
object  value 
)

Inserts the string representation of an object into this instance at the specified character position.

Parameters
indexThe position in this instance where insertion begins.
valueThe object to insert, or null.
Returns
A reference to this instance after the insert operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the length of this instance.
T:System.OutOfMemoryExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1350 of file StringBuilder.cs.

◆ Remove()

StringBuilder System.Text.StringBuilder.Remove ( int  startIndex,
int  length 
)

Removes the specified range of characters from this instance.

Parameters
startIndexThe zero-based position in this instance where removal begins.
lengthThe number of characters to remove.
Returns
A reference to this instance after the excise operation has completed.
Exceptions
T:System.ArgumentOutOfRangeExceptionIf startIndex or length is less than zero, or startIndex + length is greater than the length of this instance.

Definition at line 873 of file StringBuilder.cs.

◆ Replace() [1/4]

StringBuilder System.Text.StringBuilder.Replace ( string  oldValue,
string  newValue 
)

Replaces all occurrences of a specified string in this instance with another specified string.

Parameters
oldValueThe string to replace.
newValueThe string that replaces oldValue , or null.
Returns
A reference to this instance with all instances of oldValue replaced by newValue .
Exceptions
T:System.ArgumentNullExceptionoldValue is null.
T:System.ArgumentExceptionThe length of oldValue is zero.
T:System.ArgumentOutOfRangeExceptionEnlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1723 of file StringBuilder.cs.

◆ Replace() [2/4]

StringBuilder System.Text.StringBuilder.Replace ( string  oldValue,
string  newValue,
int  startIndex,
int  count 
)

Replaces, within a substring of this instance, all occurrences of a specified string with another specified string.

Parameters
oldValueThe string to replace.
newValueThe string that replaces oldValue , or null.
startIndexThe position in this instance where the substring begins.
countThe length of the substring.
Returns
A reference to this instance with all instances of oldValue replaced by newValue in the range from startIndex to startIndex + count - 1.
Exceptions
T:System.ArgumentNullExceptionoldValue is null.
T:System.ArgumentExceptionThe length of oldValue is zero.
T:System.ArgumentOutOfRangeExceptionstartIndex or count is less than zero.-or- startIndex plus count indicates a character position not within this instance.-or- Enlarging the value of this instance would exceed P:System.Text.StringBuilder.MaxCapacity.

Definition at line 1799 of file StringBuilder.cs.

◆ Replace() [3/4]

StringBuilder System.Text.StringBuilder.Replace ( char  oldChar,
char  newChar 
)

Replaces all occurrences of a specified character in this instance with another specified character.

Parameters
oldCharThe character to replace.
newCharThe character that replaces oldChar .
Returns
A reference to this instance with oldChar replaced by newChar .

Definition at line 1869 of file StringBuilder.cs.

◆ Replace() [4/4]

StringBuilder System.Text.StringBuilder.Replace ( char  oldChar,
char  newChar,
int  startIndex,
int  count 
)

Replaces, within a substring of this instance, all occurrences of a specified character with another specified character.

Parameters
oldCharThe character to replace.
newCharThe character that replaces oldChar .
startIndexThe position in this instance where the substring begins.
countThe length of the substring.
Returns
A reference to this instance with oldChar replaced by newChar in the range from startIndex to startIndex + count -1.
Exceptions
T:System.ArgumentOutOfRangeExceptionstartIndex + count is greater than the length of the value of this instance.-or- startIndex or count is less than zero.

Definition at line 1884 of file StringBuilder.cs.

◆ StringBuilder???()

System.Text.StringBuilder.StringBuilder??? ( string  value,
int  capacity 
)

Initializes a new instance of the T:System.Text.StringBuilder class using the specified string and capacity.

Parameters
valueThe string used to initialize the value of the instance. If value is null, the new T:System.Text.StringBuilder will contain the empty string (that is, it contains F:System.String.Empty).
capacityThe suggested starting size of the T:System.Text.StringBuilder.
Exceptions
T:System.ArgumentOutOfRangeExceptioncapacity is less than zero.

Definition at line 220 of file StringBuilder.cs.

◆ ToString() [1/2]

unsafe override string System.Text.StringBuilder.ToString ( )

Converts the value of this instance to a T:System.String.

Returns
A string whose value is the same as this instance.

Definition at line 419 of file StringBuilder.cs.

◆ ToString() [2/2]

unsafe string System.Text.StringBuilder.ToString ( int  startIndex,
int  length 
)

Converts the value of a substring of this instance to a T:System.String.

Parameters
startIndexThe starting position of the substring in this instance.
lengthThe length of the substring.
Returns
A string whose value is the same as the specified substring of this instance.
Exceptions
T:System.ArgumentOutOfRangeExceptionstartIndex or length is less than zero.-or- The sum of startIndex and length is greater than the length of the current instance.

Definition at line 461 of file StringBuilder.cs.

Property Documentation

◆ Capacity

int System.Text.StringBuilder.Capacity
getset

Gets or sets the maximum number of characters that can be contained in the memory allocated by the current instance.

Returns
The maximum number of characters that can be contained in the memory allocated by the current instance. Its value can range from P:System.Text.StringBuilder.Length to P:System.Text.StringBuilder.MaxCapacity.
Exceptions
T:System.ArgumentOutOfRangeExceptionThe value specified for a set operation is less than the current length of this instance.-or- The value specified for a set operation is greater than the maximum capacity.

Definition at line 43 of file StringBuilder.cs.

◆ Length

int System.Text.StringBuilder.Length
getset

Gets or sets the length of the current T:System.Text.StringBuilder object.

Returns
The length of this instance.
Exceptions
T:System.ArgumentOutOfRangeExceptionThe value specified for a set operation is less than zero or greater than P:System.Text.StringBuilder.MaxCapacity.

Definition at line 91 of file StringBuilder.cs.

◆ MaxCapacity

int System.Text.StringBuilder.MaxCapacity
get

Gets the maximum capacity of this instance.

Returns
The maximum number of characters this instance can hold.

Definition at line 78 of file StringBuilder.cs.

◆ this[int index]

char System.Text.StringBuilder.this[int index]
getset

Gets or sets the character at the specified character position in this instance.

Parameters
indexThe position of the character.
Returns
The Unicode character at position index .
Exceptions
T:System.ArgumentOutOfRangeExceptionindex is outside the bounds of this instance while setting a character.
T:System.IndexOutOfRangeExceptionindex is outside the bounds of this instance while getting a character.

Definition at line 145 of file StringBuilder.cs.


The documentation for this class was generated from the following file: