Create Dictionary,
- Dictionary<int, List<string>> dictionary = new Dictionary<int, List<string>>{
- {1,new List<string>{"Dee", "X", "23"}},
- {2,new List<string>{"Joe", "X", "24"}}
- };
Get the Value from Dictionary,
- void GetKeyAndValueFromDict()
- {
-
- foreach (KeyValuePair<int, List<string>> item in dictionary)
- {
- var key = item.Key;
- var value = item.Value;
- Console.WriteLine("Details are: {Name=" + value[0] + ", Class=" + value[1] + ", Roll Number=" + value[2]);
- }
- }