Ensures that the capacity of the current StringBuilder is at least the specified value.
[Visual Basic] Public Function EnsureCapacity( _ ByVal capacity As Integer _ ) As Integer [C#] public int EnsureCapacity( int capacity ); [C++] public: int EnsureCapacity( int capacity ); [JScript] public function EnsureCapacity( capacity : int ) : int;
Returns the capacity of the current string, after any changes to Capacity.
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | if capacity is less than the capacity of the current StringBuilder. |
If capacity is greater than the capacity of the current StringBuilder, then Capacity is set to capacity; otherwise Capacity is unchanged.
StringBuilder Class | StringBuilder Members | System.Text Namespace