Class DictionaryEx<TKey, TValue>
A dictionary with support for:
- deep Equals (instead of ref comparison)
- deep GetHashCode (2 refs with the same values will return the same hash code). The default dictionary returns hash code based on reference.
Implements
IDictionary<TKey, TValue>
ICollection<KeyValuePair<TKey, TValue>>
IReadOnlyDictionary<TKey, TValue>
IReadOnlyCollection<KeyValuePair<TKey, TValue>>
IEnumerable<KeyValuePair<TKey, TValue>>
IEquatable<DictionaryEx<TKey, TValue>>
Inherited Members
Namespace: Sdl.Core.Bcm.BcmModel.Collections
Assembly: Sdl.Core.Bcm.BcmModel.dll
Syntax
public class DictionaryEx<TKey, TValue> : Dictionary<TKey, TValue>, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IDictionary, ICollection, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, ISerializable, IDeserializationCallback, IEquatable<DictionaryEx<TKey, TValue>>
Type Parameters
| Name | Description |
|---|---|
| TKey | |
| TValue |
Constructors
DictionaryEx()
Initializes a new instance of the DictionaryEx<TKey, TValue> class.
Declaration
public DictionaryEx()
DictionaryEx(DictionaryEx<TKey, TValue>)
Initializes a new instance of the DictionaryEx<TKey, TValue> class, based on another instance.
Declaration
public DictionaryEx(DictionaryEx<TKey, TValue> other)
Parameters
| Type | Name | Description |
|---|---|---|
| DictionaryEx<TKey, TValue> | other | The other instance from which to construct the current instance. |
DictionaryEx(IEnumerable<KeyValuePair<TKey, TValue>>)
Initializes a new instance of the DictionaryEx<TKey, TValue> class.
Declaration
public DictionaryEx(IEnumerable<KeyValuePair<TKey, TValue>> items)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<KeyValuePair<TKey, TValue>> | items | The items. |
Methods
Equals(DictionaryEx<TKey, TValue>)
Performs a deep-equals comparison.
System.Object.Equals(object)
Declaration
public bool Equals(DictionaryEx<TKey, TValue> other)
Parameters
| Type | Name | Description |
|---|---|---|
| DictionaryEx<TKey, TValue> | other |
Returns
| Type | Description |
|---|---|
| bool |
Equals(object)
Performs a deep-equals comparison.
System.Object.Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for this instance. |