Common base class that contains code shared between Map<K,V> and MMap<K,V>.
You might notice that although Map<K,V> and MMap<K,V> have a common base class, Set<T> and MSet<T> do not, and this is a mere implementation detail. Since Set<T> is immutable, and small, and its fields can safely be initialized to 0 or null, its default value is a valid set and it makes sense to implement is as a struct. The same observation would apply to Map<K,V> except for one problem: the comparer. The user can supply a comparer of type IEqualityComparer<K>
, but but Map<K,V> contains a set of type InternalSet<KeyValuePair<K,V>>
, which requires a comparer of type IEqualityComparer<KeyValuePair<K,V>>
. In general, a wrapper object is necessary to provide this comparer, and I decided to use the set itself as the wrapper object. Therefore, Map<K,V> implements this interface, and it must be a class so that it is not boxed every time it is converted to this interface.
Finally, since Map<K,V> and MMap<K,V> are both classes and share some of the same code, I decided to factor out the common code into this base class. The end.
|
bool | ContainsKey (K key) |
|
bool | TryGetValue (K key, out V value) |
|
bool | Contains (KeyValuePair< K, V > item) |
|
void | CopyTo (KeyValuePair< K, V >[] array, int arrayIndex) |
|
InternalSet< KeyValuePair< K, V > >.Enumerator | GetEnumerator () |
|
V | TryGetValue (K key, V defaultValue) |
| Synonym for this[key, defaultValue]. More...
|
|
virtual long | CountMemory (int sizeOfPair) |
| Measures the total size of all objects allocated to this collection, in bytes, including the size of this object itself; see InternalSet<T>.CountMemory. More...
|
|
V | TryGet (K key, out bool fail) |
| Gets the item for the specified key or index, and does not throw an exception on failure. More...
|
|