Check out example codes for "how to print dictionary in c# with for loop". It will help you in understanding the concepts better.
Code Example 1
using System;
using System.Linq;
using System.Collections.Generic;
public class Example
{
public static void PrintDict<K,V>(Dictionary<K,V> dict)
{
for (int i = 0; i < dict.Count; i++)
{
KeyValuePair<K, V> entry = dict.ElementAt(i);
Console.WriteLine(entry.Key + " : " + entry.Value);
}
}
public static void Main()
{
Dictionary<string, string> dict = new Dictionary<string, string>
{
{ "key1", "value1" },
{ "key2", "value2" }
};
PrintDict(dict);
}
}
/*
Output:
key1 : value1
key2 : value2
*/
Learn ReactJs, React Native from akashmittal.com