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

System.Text.StringBuilder.EnsureCapacity Method

Ensures that the capacity of the current instance is at least a specified value. [Edit]

public int EnsureCapacity (int capacity)

Parameters

capacity
A int containing the minimum capacity to ensure. [Edit]

Returns

A int equal to the new StringBuilder.Capacity of the current instance. [Edit]

Exceptions

TypeReason
ArgumentOutOfRangeExceptioncapacity is less zero. [Edit]

Remarks

If the specified value is less than the current StringBuilder.Capacity, no changes are made and StringBuilder.Capacity remains the same.

Note: For performance reasons, the new StringBuilder.Capacity might be larger than the specified value. The amount of memory allocated by this method is implementation specific.

[Edit]

Requirements

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