Gets or sets the maximum number of characters that can be contained in the memory allocated by the current instance.
A int containing the maximum number of characters that can be contained in the memory allocated by the current instance.
Type Reason ArgumentException The value specified for a set operation is less than StringBuilder.Length.
StringBuilder.Capacity does not affect the string value of the current instance. StringBuilder.Capacity can be decreased as long as it is not less than StringBuilder.Length.
The System.Text.StringBuilder dynamically allocates more space when required and increases StringBuilder.Capacity accordingly. For performance reasons, a System.Text.StringBuilder might allocate more memory than needed. The amount of memory allocated is implementation-specific.