Reputation: 99
I have
IList<IDictionary<string, object>>
How get without duplication keys from all of dictionaries inside this IList
and put them to IList<string>
using LINQ?
Upvotes: 4
Views: 591
Reputation: 37770
Use SelectMany
and Distinct
List<string> uniquekeys = listOfDictionaries
.SelectMany(d => d.Keys)
.Distinct()
.ToList();
Upvotes: 10