Table of Contents

Class ImmutableValueDictionary<TKey, TValue>

Namespace
GuildWars2.Collections
Assembly
GuildWars2.dll

Represents an immutable dictionary collection with value semantics, meaning two ImmutableValueDictionary<TKey, TValue> instances are considered equal if their contents are equal.

[JsonConverter(typeof(ImmutableValueDictionaryJsonConverter))]
[SuppressMessage("Style", "IDE0028", Justification = "Cannot simplify constructor calls that wrap ImmutableDictionary<TKey, TValue>.")]
[SuppressMessage("Style", "IDE0301", Justification = "Cannot simplify to collection expression.")]
[SuppressMessage("Style", "IDE0303", Justification = "Cannot simplify to collection expression.")]
public sealed class ImmutableValueDictionary<TKey, TValue> : 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 the keys in the dictionary.

TValue

The type of the values in the dictionary.

Inheritance
ImmutableValueDictionary<TKey, TValue>
Implements
IImmutableDictionary<TKey, TValue>
IReadOnlyDictionary<TKey, TValue>
IEnumerable<KeyValuePair<TKey, TValue>>
Inherited Members

Constructors

ImmutableValueDictionary()

Initializes a new instance of the ImmutableValueDictionary<TKey, TValue> class that is empty.

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

Initializes a new instance of the ImmutableValueDictionary<TKey, TValue> class that contains elements copied from the specified collection.

Properties

Count
Empty

Gets an empty ImmutableValueDictionary<TKey, TValue>.

this[TKey]
Keys
Values

Methods

Add(TKey, TValue)

Creates a new ImmutableValueDictionary<TKey, TValue> with the specified key and value added.

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

Creates a new ImmutableValueDictionary<TKey, TValue> with the specified key-value pairs added.

Clear()

Creates a new ImmutableValueDictionary<TKey, TValue> with all items removed.

Contains(KeyValuePair<TKey, TValue>)

Determines whether the dictionary contains the specified key-value pair.

ContainsKey(TKey)
Equals(IImmutableValueDictionary<TKey, TValue>?)

Determines whether the current ImmutableValueDictionary<TKey, TValue> is equal to another IImmutableValueDictionary<TKey, TValue> based on value semantics.

Equals(object?)
GetEnumerator()
GetHashCode()

Returns a hash code based on the keys and values in the dictionary.

Remove(TKey)

Creates a new ImmutableValueDictionary<TKey, TValue> with the specified key removed.

RemoveRange(IEnumerable<TKey>)

Creates a new ImmutableValueDictionary<TKey, TValue> with the specified keys removed.

SetItem(TKey, TValue)

Creates a new ImmutableValueDictionary<TKey, TValue> with the specified key and value added or updated.

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

Creates a new ImmutableValueDictionary<TKey, TValue> with the specified key-value pairs set, adding or updating as necessary.

TryGetKey(TKey, out TKey)

Searches the dictionary for a given key and returns the equal key it finds, if any.

TryGetValue(TKey, out TValue)

Operators

operator ==(ImmutableValueDictionary<TKey, TValue>?, ImmutableValueDictionary<TKey, TValue>?)

Determines whether two ImmutableValueDictionary<TKey, TValue> instances are equal by value.

operator !=(ImmutableValueDictionary<TKey, TValue>?, ImmutableValueDictionary<TKey, TValue>?)

Determines whether two ImmutableValueDictionary<TKey, TValue> instances are not equal by value.