I have a Dictionary
and I need to convert it into a List
where Data
has the properties lab
public class Data
{
public string Key { get; set; }
public int Value { get; set; }
}
private static void Main(string[] args)
{
Dictionary dictionary1 = new Dictionary();
dictionary1.Add("key1", 1);
dictionary1.Add("key2", 2);
List data = dictionary1.Select(z => new Data { Key = z.Key, Value = z.Value }).ToList();
Console.ReadLine();
}