Map<K1, K2, V>
Map<K1, K2, V> is a 2 key map. It implements an interface of IMap<K1, K2, V>. It is recommended that you use the IMap interfaces if you prefer to not link to the class types (in parameter or field types). If it is needed, all Map types also implement the IDictionary interface. However, due to the potential performance loss for treating a Map as an IDictionary (see
Best Practices), it is recommended to not use the IDictionary interface unless you need to.
public Func<K1, K2, V> DefaultGeneration
Allows you to specify a default generation when requesting new keys. See
DefaultGeneration.
var unitByLocationCache = new Map<int, int, List<Unit>>();
unitByLocationCache.DefaultGeneration = (x, y) => new List<Unit>();
foreach (var unit in GameUnits)
{
unitByLocationCache[unit.X, unit.Y].Add(unit);
}
public V DefaultValue
Allows you to specify a default value to return for nonexistent keys. See
DefaultValue.
public List<KeyValueSet<Tuple<K1, K2>, V>> KeyValues
Return a strong types list of KeyValues. Each Map class have a version of KeyValues, simplifying iteration syntax.
public bool ContainsKey(K1 k1, K2 k2)
Returns true if the key pair was found.
public bool Remove(K1 k1, K2 k2)
Removes the key pair. Returns true if the key pair was found, else false.