Dictionary type.
    public class Dictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable

Dictionary type. Associative container which contains values referenced by unique keys. Dictionaries are always passed by reference.

Erasing elements while iterating over them is not supported.

Creating a dictionary:


var d = {4: 5, “A key”: “A value”, 28: [1, 2, 3]}


To add a key to an existing dictionary, access it like an existing key and assign to it:


d[4] = “hello” # Add integer 4 as a key and assign the String “hello” as its value.

d[“Godot”] = 3.01 # Add String “Godot” as a key and assign the value 3.01 to it.


Inheritance Chain



    public Dictionary()

    public Dictionary(IDictionary<TKey, TValue> dictionary)

    public Dictionary(Dictionary dictionary)


    public int Count { get; }

    public bool IsReadOnly { get; }

    public ICollection&lt;TKey&gt; Keys { get; }

    public TValue this[] { get; set; }

    public ICollection&lt;TValue&gt; Values { get; }


    public void Add(TKey key, TValue value)

    public void Add(KeyValuePair<TKey, TValue> item)

    public void Clear()

    public bool Contains(KeyValuePair<TKey, TValue> item)

    public bool ContainsKey(TKey key)

    public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)

    public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()

    public bool Remove(TKey key)

    public bool Remove(KeyValuePair<TKey, TValue> item)

    public override string ToString()

    public bool TryGetValue(TKey key, out TValue value)

Conversion Operators

    public static explicit operator Dictionary(Dictionary<TKey, TValue> from)