Mono Class Library: System.Text.StringBuilder Overview | Members

System.Text.StringBuilder.Capacity Property

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

public int Capacity { set; get; }

Value

A int containing the maximum number of characters that can be contained in the memory allocated by the current instance.

Exceptions

TypeReason
ArgumentExceptionThe value specified for a set operation is less than StringBuilder.Length.

Remarks

The StringBuilder.Capacity property does not affect the string value of the current instance. The System.Text.StringBuilder will dynamically increase the StringBuilder.Capacity and allocate more space when it is required.

Note: For performance reasons a System.Text.StringBuilder might allocate more memory than needed. The amount of memory allocated is implementation specific.

Requirements

Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0