// Iterate group items with a nested foreach. This IGroupin
// Iterate group items with a nested foreach. This IGrouping encapsulates // a sequence of Student objects, and a Key of type char. // For convenience, var can also be used in the foreach statement. foreach (IGrouping<char, Student> studentGroup in studentQuery2) { Console.WriteLine(studentGroup.Key); // Explicit type for student could also be used here. foreach (var student in studentGroup) { Console.WriteLine(" {0}, {1}", student.Last, student.First); } }
,温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/36935.html