The following tables list the members exposed by WeakDictionary<TKey,TValue>.
Name | Description | |
---|---|---|
WeakDictionary<TKey,TValue> Constructor | Overloaded. |
Name | Description | |
---|---|---|
Count | Returns the number of entries in the dictionary. Note that this will not take into account any garbage collected items - they will be included in the count. | |
Item | Gets or sets the value associated with the specified key. Set will add an entry for the key if it doesn't already exist. | |
Keys | Returns the keys in the dictionary. Only keys with non-null values are returned. | |
Values | Returns the values in the dictionary. Only values with non-null keys are returned. |
Name | Description | |
---|---|---|
Add | Adds an entry to the dictionary. If an entry with the specified key already exists, this method throws an exception. | |
Clear | Removes all entries from the dictionary. | |
Compact | Removes entries from the dictionary where keys are no longer alive (have been garbage collected). Note that keys can get garbage collected during the process of compacting and therefore it's not guarrenteed that all the entries in the dictionary will be with live keys after this operation is completed. | |
ContainsKey | Returns true if an entry with the specified key exists in the dictionary. | |
Remove | Removes the entry with the specified key. Does nothing if the specified key doesn't exist. | |
TryGetValue | Gets the value associated with the specified key. If the entry doesn't exist, returns false. |