user17921
4
Q:

how to add object in dictionary in c#

// To add an item to a dictionary use 'Add()'
dict.Add(1,"One");
3
public TValue this[TKey key]
{
    get
    {
        int index = this.FindEntry(key);
        if (index >= 0)
        {
            return this.entries[index].value;
        }
        ThrowHelper.ThrowKeyNotFoundException();
        return default(TValue);
    }
    set
    {
        this.Insert(key, value, false);
    }
}
0

New to Communities?

Join the community