Method EnsureCapacity
EnsureCapacity(int)
Ensures that the dictionary can hold up to a specified number of key/value set pairs without any further expansion of its backing storage.
Declaration
public int EnsureCapacity(int capacity)
Parameters
| Type | Name | Description |
|---|---|---|
| int | capacity | The number of key/value set pairs. |
Returns
| Type | Description |
|---|---|
| int | The current capacity of the dictionary. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Capacity specified is less than 0. |