List<T>.EnsureCapacity(Int32) Method

Definition

Ensures that the capacity of this list is at least the specified capacity. If the current capacity is less than capacity, it is successively increased to twice the current capacity until it is at least the specified capacity.

public:
 int EnsureCapacity(int capacity);
public int EnsureCapacity (int capacity);
member this.EnsureCapacity : int -> int
Public Function EnsureCapacity (capacity As Integer) As Integer

Parameters

capacity
Int32

The minimum capacity to ensure.

Returns

Int32

The new capacity of this list.

Applies to