Get keys from IList <IDictionary <string, object >>

I have

IList<IDictionary<string, object>> 

How to get without duplicate keys from all dictionaries inside this IListand put them in IList<string>using LINQ?

+4
source share
1 answer

Use SelectManyandDistinct

List<string> uniquekeys = listOfDictionaries
    .SelectMany(d => d.Keys)
    .Distinct()
    .ToList();
+10
source

Source: https://habr.com/ru/post/1619006/


All Articles