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
solved How to write this nested foreach loop query in LINQ?