HashSet<T>.EnsureCapacity(Int32) Method

Definition

Ensures that this hash set can hold the specified number of elements without any further expansion of its backing storage.

public int EnsureCapacity (int capacity);

Parameters

capacity
Int32

The minimum capacity to ensure.

Returns

The new capacity of this instance.

Exceptions

capacity is less than zero.

Applies to

Product Versions
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Standard 2.1