<PackageReference Include="System.ObjectModel" Version="4.0.11-beta-23409" />

KeyedCollection<TKey, TItem>

public abstract class KeyedCollection<TKey, TItem> : Collection<TItem>
Provides the abstract base class for a collection whose keys are embedded in the values.
public IEqualityComparer<TKey> Comparer { get; }

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

protected IDictionary<TKey, TItem> Dictionary { get; }

Gets the lookup dictionary of the KeyedCollection<T, U>.

public TItem this[TKey key] { get; }

Gets the element with the specified key.

protected KeyedCollection()

Initializes a new instance of the KeyedCollection<T, U> class that uses the default equality comparer.

protected KeyedCollection(IEqualityComparer<TKey> comparer)

Initializes a new instance of the KeyedCollection<T, U> class that uses the specified equality comparer.

protected KeyedCollection(IEqualityComparer<TKey> comparer, int dictionaryCreationThreshold)

Initializes a new instance of the KeyedCollection<T, U> class that uses the specified equality comparer and creates a lookup dictionary when the specified threshold is exceeded.

protected void ChangeItemKey(TItem item, TKey newKey)

Changes the key associated with the specified element in the lookup dictionary.

public bool Contains(TKey key)

Determines whether the collection contains an element with the specified key.

protected abstract TKey GetKeyForItem(TItem item)

When implemented in a derived class, extracts the key from the specified element.

public bool Remove(TKey key)

Removes the element with the specified key from the KeyedCollection<T, U>.