System.Collections.ObjectModel.KeyedCollection<TKey,TItem>.ClearItems Method

Removes all elements from the System.Collections.ObjectModel.KeyedCollection`2.

Syntax

protected override void ClearItems ()

Remarks

If there is a lookup dictionary, this method clears it but does not delete it.

If the number of elements has exceeded the dictionary creation threshold and the System.Collections.ObjectModel.KeyedCollection`2 is using a lookup dictionary, it will continue to use a lookup dictionary even though the number of elements is again under the threshold.

This method is an O(n) operation, where n is Collection`1.Count.

Notes for Implementers

Override this method to provide customized behavior for the Collection`1.Clear method, inherited from the System.Collections.ObjectModel.Collection`1 generic class.

Call the base class implementation of this method to clear the underlying collection and to clear the lookup dictionary.

Requirements

Namespace: System.Collections.ObjectModel
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0