C#C
C#10mo ago
Faker

✅ Nested from clause in query syntax

C#
var largeCitiesList = (
    from country in countries
    from city in country.Cities
    where city.Population > 10000
    select city
).ToList();

// or split the expression
IEnumerable<City> largeCitiesQuery =
    from country in countries
    from city in country.Cities
    where city.Population > 10000
    select city;
var largeCitiesList2 = largeCitiesQuery.ToList();


Hello guys, can someone explain the use of the nested from clause in the code above please. Why do we use nested from? Couldn't we just use the dot notation, like country.Cities? Why would it matter here?
Was this page helpful?