Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: void AddSafe<K1, K2, V>(this IDictionary<K1, Dictionary<K2, V>>, K1, K2, V, IEqualityComparer<K2>)

Declaration

public static void AddSafe<K1, K2, V>(
    this IDictionary<K1, Dictionary<K2, V>> dic,
    K1 key1,
    K2 key2,
    V value,
    IEqualityComparer<K2> comparer = null
)

Summary

Adds an element to a two-level Dictionary<,>. If the specified key does not exist in the outer Dictionary, a new Dictionary is created.

Generic type parameters

K1 Type of the key of the outer Dictionary.
K2 Type of the key of the inner Dictionary.
V Type of the values in the inner Dictionary.

Parameters

this IDictionary<K1, Dictionary<K2, V>>dic Dictionary to operate on.
K1key1 Key at which the inner Dictionary is located in the outer Dictionary.
K2key2 Key at which the value is located in the inner Dictionary.
Vvalue Value to add to the inner Dictionary.
IEqualityComparer<K2>comparer Optional equality comparer to pass into the inner dictionary if a new one is created.