mscorlib 2.0.0.0 4.0.0.0 System.Collections.ObjectModel.Collection<TItem> TItem System.Diagnostics.DebuggerDisplay("Count={Count}") System.Diagnostics.DebuggerTypeProxy(typeof(System.Collections.Generic.CollectionDebuggerView`2)) System.Runtime.InteropServices.ComVisible(false) To be added. To be added.

The class provides both O(1) indexed retrieval and keyed retrieval that approaches O(1). It is an abstract type, or more accurately an infinite set of abstract types, because each of its constructed generic types is an abstract base class. To use , derive your collection type from the appropriate constructed type.

The class is a hybrid between a collection based on the generic interface and a collection based on the generic interface. Like collections based on the generic interface, is an indexed list of items. Like collections based on the generic interface, has a key associated with each element.

Unlike dictionaries, an element of is not a key/value pair; instead, the entire element is the value and the key is embedded within the value. For example, an element of a collection derived from KeyedCollection<String,String> (KeyedCollection(Of String, String) in Visual Basic) might be "John Doe Jr." where the value is "John Doe Jr." and the key is "Doe"; or a collection of employee records containing integer keys could be derived from KeyedCollection<int,Employee>. The abstract method extracts the key from the element.

By default, the includes a lookup dictionary that you can obtain with the property. When an item is added to the , the item's key is extracted once and saved in the lookup dictionary for faster searches. This behavior is overridden by specifying a dictionary creation threshold when you create the . The lookup dictionary is created the first time the number of elements exceeds that threshold. If you specify –1 as the threshold, the lookup dictionary is never created.

When the internal lookup dictionary is used, it contains references to all the items in the collection if is a reference type, or copies of all the items in the collection if is a value type. Thus, using the lookup dictionary may not be appropriate if is a value type.

You can access an item by its index or key by using the property. You can add items without a key, but these items can subsequently be accessed only by index.

Provides the abstract base class for a collection whose keys are embedded in the values.

- Constructor
  2.0.0.0
  4.0.0.0

  A created with this constructor uses the default generic equality comparer for the type of the key, obtained from . To specify a different generic equality comparer, use the constructor or the constructor.

  By default, the includes a lookup dictionary that is created when the first item is added. When an item is added to the , the item's key is extracted once and saved in the lookup dictionary for faster searches. This behavior can be overridden by using the constructor and specifying a dictionary creation threshold.

  Because the class is abstract (MustInherit in Visual Basic), you must derive from it in order to use it. In the constructor for your derived type, call the appropriate constructor. It is not necessary to expose functionality like the equality comparer or the dictionary creation threshold in your constructors.

  This constructor is an O(1) operation.

  Initializes a new instance of the class that uses the default equality comparer.

- Constructor
  2.0.0.0
  4.0.0.0
  To be added.
  To be added.
  To be added.
- Constructor
  2.0.0.0
  4.0.0.0
  To be added.
  To be added.
  To be added.
  To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` `` To be added. To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Void

  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 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() operation, where is .

  ## Notes for Implementers

  Override this method to provide customized behavior for the method, inherited from the generic class.

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

  Removes all elements from the .

- Property
  2.0.0.0
  4.0.0.0
  System.Collections.Generic.IEqualityComparer<TKey> To be added.

  Retrieving the value of this property is an O(1) operation.

  Gets the generic equality comparer that is used to determine equality of keys in the collection.

- Method
  2.0.0.0
  4.0.0.0
  System.Boolean `` To be added. To be added. To be added. To be added.
- Property
  2.0.0.0
  4.0.0.0
  System.Collections.Generic.IDictionary<TKey,TItem> To be added.

  By default, the includes a lookup dictionary that is created when the first item is added. When an item is added to the , the item's key is extracted once and saved in the lookup dictionary for faster searches. This behavior can be overridden by using the constructor and specifying a dictionary creation threshold.

  Retrieving the value of this property is an O(1) operation.

  Gets the lookup dictionary of the .

- Method
  2.0.0.0
  4.0.0.0
  TKey `` To be added. To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` `` To be added. To be added. To be added. To be added.
- Property
  2.0.0.0
  4.0.0.0
  TItem `` To be added. To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Boolean `` To be added. To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Void ``

  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 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() operation, where is .

  ## Notes for Implementers

  Override this method to provide customized behavior for the and methods, inherited from the generic class, and the method.

  Call the base class implementation of this method to remove the item from the underlying collection and to update the lookup dictionary.

  Removes the element at the specified index of the .

  The index of the element to remove.
- Method
  2.0.0.0
  4.0.0.0
  System.Void `` `` To be added. To be added. To be added. To be added.