IDictionary<TKey,TValue> Interface

Definition

Provides access to values by key.

Delphi
IDictionary<TKey,TValue> = interface(ICollection<TPair<TKey, TValue>>)

Type Parameters

TKey

The type of keys in the dictionary.

TValue

The type of values in the dictionary.

Inheritance
IInterface
IDictionary<TKey,TValue>
Derived

Remarks

Members inherited from ICollection<T> operate on TPair<TKey,TValue> values. Inherited Contains and Remove operations require both the key and value to match. Keys use the dictionary's key comparer; values use the default equality comparer for TValue. Inherited Add raises EArgumentException when the pair's key already exists.

Properties

Count

Gets the number of values in the collection.

(Inherited from IReadOnlyCollection<T>)
Items[TKey]

Gets or sets the value associated with the specified key.

Keys

Gets a read-only collection that contains the keys in the dictionary.

Values

Gets a read-only collection that contains the values in the dictionary.

Methods

Add(TKey, TValue)

Adds the specified key and value to the dictionary.

AddRange(IEnumerable<T>)

Adds the values in a sequence to the collection.

(Inherited from ICollection<T>)
AddRange(array of T)

Adds the values in an open array to the collection.

(Inherited from ICollection<T>)
Clear

Removes all values from the collection.

(Inherited from ICollection<T>)
Contains(T)

Determines whether the collection contains a specific value.

(Inherited from IReadOnlyCollection<T>)
ContainsKey(TKey)

Determines whether the dictionary contains a specific key.

GetCount

Gets the number of values in the collection.

(Inherited from IReadOnlyCollection<T>)
GetEnumerator

Returns an enumerator that iterates through the sequence.

(Inherited from IEnumerable<T>)
GetItem(TKey)

Gets the value associated with the specified key.

GetKeys

Returns a read-only collection that contains the keys in the dictionary.

GetValues

Returns a read-only collection that contains the values in the dictionary.

IsEmpty

Determines whether the collection contains no values.

(Inherited from IReadOnlyCollection<T>)
Remove(TKey)

Removes the value with the specified key from the dictionary.

SetItem(TKey, TValue)

Adds or replaces the value associated with the specified key.

TryGetValue(TKey, TValue)

Returns the value associated with a key.

See also