static void Main(string[] args)
{
IEnumerable<IGrouping<string,Student>> studentGroup = studentList.GroupBy(s => s.ClassName);
foreach (IGrouping<string, Student> item in studentGroup)
{
Console.WriteLine(item.Key);
//对item 在进行遍历
foreach (Student student in item)
{
Console.WriteLine(student.StudentName);
}
}
Console.ReadKey();
}