I have a Dictionary dictionary1 and I need to convert it into a List where Data has the properties lab
Dictionary dictionary1
List
Data
lab
Assuming:
class Data { public string Label { get; set; } public int Value { get; set; } }
Then:
Dictionary dic; List list = dic.Select(p => new Data { Label = p.Key, Value = p.Value }).ToList();