/// <summary> /// Adds a new value to the dictionary. /// </summary> /// <param name="key1">First level key.</param> /// <param name="key2">Second level key.</param> /// <param name="key3">Third level key.</param> /// <param name="value">Value to Add.</param> public void Add(TKey1 key1, TKey2 key2, TKey3 key3, TValue value) { if (!TryGetValue(key1, out DualKeyDictionary <TKey2, TKey3, TValue> sdic)) { sdic = new DualKeyDictionary <TKey2, TKey3, TValue>(); this[key1] = sdic; } sdic.Add(key2, key3, value); }
/// <summary> /// Sets or returns the value for both key levels. /// </summary> /// <param name="key1">First level key.</param> /// <param name="key2">Second level key.</param> /// <param name="key3">Third level key.</param> public TValue this[TKey1 key1, TKey2 key2, TKey3 key3] { get { var sdic = this[key1]; return(sdic[key2][key3]); } set { if (!TryGetValue(key1, out DualKeyDictionary <TKey2, TKey3, TValue> sdic)) { sdic = new DualKeyDictionary <TKey2, TKey3, TValue>(); this[key1] = sdic; } sdic[key2, key3] = value; } }