Consider this query to group a list of students by the 1st letter of their last name:
var query = from s in students
group s by s.Last[0] into group1
orderby group1.Key
from g in group1
select new { g.First, g.Last }
Now, the part that says from g in group1
is not iterating through the keys of group1
, it's iterating through the values of each key in group1
.
This is how I'd like it to be handled (to produce a flat list), but it seems counter intuitive to me.
To answer my question, I just need someone to point me to the part of MSDN that explains this or explain why I'm the counter intuitive one ;-)