2using System.Collections;
3using System.Collections.Generic;
4using System.Runtime.Serialization;
11 [DataContract(Name =
"HashMap", Namespace = Constants.DataContractNamespace)]
12 public abstract class HashMapBase<TKey, TValue> : ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IReadOnlyDictionary<TKey, TValue>, ICollection
17 public Dictionary<TKey, TValue>
Dictionary {
get;
protected set; } =
new Dictionary<TKey, TValue>();
32 ICollection<TKey> IDictionary<TKey, TValue>.Keys =>
Dictionary.Keys;
38 ICollection<TValue> IDictionary<TKey, TValue>.Values =>
Dictionary.Values;
47 IEnumerable<TKey> IReadOnlyDictionary<TKey, TValue>.Keys => ((IReadOnlyDictionary<TKey, TValue>)
Dictionary).Keys;
50 IEnumerable<TValue> IReadOnlyDictionary<TKey, TValue>.Values => ((IReadOnlyDictionary<TKey, TValue>)
Dictionary).Values;
53 public void Add(KeyValuePair<TKey, TValue> item)
55 ((ICollection<KeyValuePair<TKey, TValue>>)
Dictionary).Add(item);
59 public void Add(TKey key, TValue value)
71 public bool Contains(KeyValuePair<TKey, TValue> item)
73 return ((ICollection<KeyValuePair<TKey, TValue>>)
Dictionary).Contains(item);
83 public void CopyTo(KeyValuePair<TKey, TValue>[] array,
int arrayIndex)
85 ((ICollection<KeyValuePair<TKey, TValue>>)
Dictionary).CopyTo(array, arrayIndex);
89 public void CopyTo(Array array,
int index)
91 ((ICollection)
Dictionary).CopyTo(array, index);
101 IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()
107 public bool Remove(KeyValuePair<TKey, TValue> item)
109 return ((ICollection<KeyValuePair<TKey, TValue>>)
Dictionary).Remove(item);
121 return Dictionary.TryGetValue(key, out value);
125 IEnumerator IEnumerable.GetEnumerator()
127 return ((IEnumerable)
Dictionary).GetEnumerator();
The base class for dictionaries with custom data contract serialization.
bool Contains(KeyValuePair< TKey, TValue > item)
void Add(TKey key, TValue value)
bool ContainsKey(TKey key)
Dictionary< TKey, TValue >.KeyCollection Keys
void CopyTo(Array array, int index)
Dictionary< TKey, TValue >.ValueCollection Values
bool Remove(KeyValuePair< TKey, TValue > item)
Dictionary< TKey, TValue >.Enumerator GetEnumerator()
bool TryGetValue(TKey key, out TValue value)
Dictionary< TKey, TValue > Dictionary
The underlying dictionary.
void CopyTo(KeyValuePair< TKey, TValue >[] array, int arrayIndex)
void Add(KeyValuePair< TKey, TValue > item)