public int EnsureCapacity(
int capacity
)
Public Function EnsureCapacity (
capacity As Integer
) As Integer
public:
int EnsureCapacity(
int capacity
)
member EnsureCapacity :
capacity : int -> int
If the specified capacity is less than or equal to the current Capacity, then the Capacity is left unchanged.
If the specified capacity is less than twice of the current Capacity, then current Capacity is doubled.
If the specified capacity is at least twice of the current Capacity, then Capacity is set to the specified capacity.
If capacity is changed, then this method is an O(n) operation where n is Count. If capacity is not changed, then this method is an O(1) operation.
ArgumentOutOfRangeException | capacity must not be negative. |