Table of Contents

Interface IImmutableValueDictionary<TKey, TValue>

Namespace
GuildWars2.Collections
Assembly
GuildWars2.dll

Represents an immutable dictionary with value semantics for equality comparison.

[JsonConverter(typeof(ImmutableValueDictionaryJsonConverterFactory))]
public interface IImmutableValueDictionary<TKey, TValue> : IImmutableDictionary<TKey, TValue>, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IEquatable<IImmutableValueDictionary<TKey, TValue>> where TKey : notnull

Type Parameters

TKey

The type of keys in the dictionary.

TValue

The type of values in the dictionary.

Inherited Members

Remarks

This interface extends IImmutableDictionary<TKey, TValue> with value-based equality and covariant return types. The shadowed members return IImmutableValueDictionary<TKey, TValue> instead of IImmutableDictionary<TKey, TValue>, satisfying the Liskov Substitution Principle: the more specific return type is still assignable to the base type.

C# does not support return type covariance on interface implementations directly, so member shadowing with the new keyword is used to achieve the same effect.

Methods

Add(TKey, TValue)

Adds an element with the specified key and value to the dictionary.

AddRange(IEnumerable<KeyValuePair<TKey, TValue>>)

Adds the specified key/value pairs to the dictionary.

Clear()

Retrieves an empty dictionary that has the same ordering and key/value comparison rules as this dictionary instance.

Remove(TKey)

Removes the element with the specified key from the immutable dictionary.

RemoveRange(IEnumerable<TKey>)

Removes the elements with the specified keys from the immutable dictionary.

SetItem(TKey, TValue)

Sets the specified key and value in the immutable dictionary, possibly overwriting an existing value for the key.

SetItems(IEnumerable<KeyValuePair<TKey, TValue>>)

Sets the specified key/value pairs in the immutable dictionary, possibly overwriting existing values for the keys.