[Solved] How to write this nested foreach loop query in LINQ?

[ad_1]

It should be something like this (Use SelectMany and Count methods):

int c = elements.SelectMany(e => e.Attributes)
                .Count(a => a.Name == "City" && a.GetValue().ToString() == "Oakland");

0

[ad_2]

solved How to write this nested foreach loop query in LINQ?