Check out example codes for "access dic by key c#". It will help you in understanding the concepts better.
Code Example 1
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
Dictionary<string, int> dictionary = new Dictionary<string, int>();
dictionary.Add("apple", 1);
dictionary.Add("windows", 5);
// See whether Dictionary contains this string.
if (dictionary.ContainsKey("apple"))
{
int value = dictionary["apple"];
Console.WriteLine(value);
}
// See whether it contains this string.
if (!dictionary.ContainsKey("acorn"))
{
Console.WriteLine(false);
}
}
}
Code Example 2
IDictionary<int, string> dict = new Dictionary<int, string>();
//or
Dictionary<int, string> dict = new Dictionary<int, string>();
Learn ReactJs, React Native from akashmittal.com