/// <summary> Gets or sets a key-value pair in this dictionary. </summary> /// <param name="key"> The key of the value to get, or the key to associated the set value with. When setting, adds if the key is not present. </param> public TValue this[TKey key] { get { return(values[indices[key]]); } set { int index; if (indices.TryGetValue(key, out index)) { indices[key] = values.Change(index, value); } else { Add(key, value); //like the standard dictionary, the value is added if the key is not present } } }