Dictionary<TKey,TValue>.EnsureCapacity(Int32) Dictionary<TKey,TValue>.EnsureCapacity(Int32) Dictionary<TKey,TValue>.EnsureCapacity(Int32) Dictionary<TKey,TValue>.EnsureCapacity(Int32) Method

定義

確保字典最多可以保留指定的項目數量,但不必進一步擴充其支援儲存體。Ensures that the dictionary can hold up to a specified number of entries without any further expansion of its backing storage.

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 Int32 Int32 Int32

項目數量。The number of entries.

傳回

Dictionary<TKey,TValue> 目前的容量。The current capacity of the Dictionary<TKey,TValue>.

例外狀況

適用於