دنبال کننده ها

۱۳۹۶ آذر ۱۰, جمعه

C# LINQ get first list items of a dictionary>

[ad_1]



I have a dictionary of lists and I would like to get a list of the first elements of each list in the dictionary. Basically:



 Dictionary<string, List<object>> dico = new Dictionary<string, List<Object>>();

// fill data...

List<object> list = new List<Object>();
foreach(var value in dico.Values)

list.Add(value.ElementAt(0));



Can this be done with LINQ.



Thanks a lot.




[ad_2]

لینک منبع