Method TrimExcess
TrimExcess(bool)
Sets the key/value set pair capacity of this dictionary to what it would be if it had been originally initialized with all its entries, and optionally trims all the value sets in the dictionary as well.
Declaration
public void TrimExcess(bool trimValueSets = true)
Parameters
Type | Name | Description |
---|---|---|
bool | trimValueSets | true to trim all the value sets as well, or false to only trim the dictionary. |
TrimExcess(int, bool)
Sets the key/value set pair capacity of this dictionary to hold up to a specified number of entries without any further expansion of its backing storage, and optionally trims the capacity of each value set to the actual number of values in the list.
Declaration
public void TrimExcess(int dictionaryCapacity, bool trimValueSets = true)
Parameters
Type | Name | Description |
---|---|---|
int | dictionaryCapacity | The new key/value set pair capacity. |
bool | trimValueSets | true to trim all the value sets as well, or false to only trim the dictionary. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Capacity specified is less than the number of entries in the dictionary. |