KeyedCollection(Of TKey, TItem).Remove Method (TKey)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Removes the element with the specified key from the KeyedCollection(Of TKey, TItem).
Assembly: mscorlib (in mscorlib.dll)
Parameters
- key
- Type: TKey
The key of the element to remove.
Return Value
Type: System.Booleantrue if the element is successfully removed; otherwise, false. This method also returns false if key is not found in the KeyedCollection(Of TKey, TItem).
| Exception | Condition |
|---|---|
| ArgumentNullException | key is Nothing. |
The key of the element is also removed from the lookup dictionary.
If the number of elements has exceeded the dictionary creation threshold and the KeyedCollection(Of TKey, TItem) is using a lookup dictionary, it will continue to use a lookup dictionary even though the number of elements is again under the threshold.
Note: |
|---|
To customize the behavior of this method, override the RemoveItem method. |
This method is an O(n) operation, where n is Count.
Note: