HashSet<T>.EnsureCapacity(Int32) 方法

定義

確保此雜湊集可以包含指定的元素數目,而不需要擴充。Ensures that this hash set can hold the specified number of elements without growing.

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

參數

capacity
Int32

要確定的最大容量。The minimum capacity to ensure.

傳回

Int32

這個執行個體的新容量。The new capacity of this instance.

例外狀況

capacity 小於零。capacity is less than zero.

適用於