当前位置:首页 > Windows程序 > 正文

// Iterate group items with a nested foreach. This IGroupin

2024-03-31 Windows程序

// 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

Jm-杰米博客Jamie
草根站长的技术交流乐园!IT不会不要紧快来好好学习吧!
  • 20786文章总数
  • 7494592访问次数
  • 建站天数
  • 友情链接