Using below program we can convert the dictionary to list in c#.net
static void Main(string[] args)
{
List<string> lst = new List<string>();
lst.Add("ranga");
lst.Add("Rajesh");
//convert dictionary to list
Dictionary<string, int> empDictionary = new Dictionary<string, int>();
foreach(var data in lst)
{
empDictionary.Add(data, 1);
}
foreach(var data in empDictionary)
{
Console.Write("key:"+ data.Key);
Console.WriteLine(" value:"+data.Value);
}
Console.Read();
}
output:
If you have any queries or suggestions, please feel free to ask in comments section.
Post a Comment
Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.