首页 > 解决方案 > 如何在 C# 中的 ListView 上运行 Linq 查询?

问题描述

我想在 C# 中的 ListView 上运行 Linq 查询。

我的目标是检查所有年轻学生的名单,除了我的 ListView 的每组中最年长的学生

BindingList<StudentsList> MyStudents = new BindingList<StudentsList>();

private void Query()
{   
var results = MyStudents.OrderByDescending(x => x.DateTime)
                            .GroupBy(x => x.DateTime)
                            .Select(x => x.First())
                            .ToList();}         

public class StudentsList
{
public StudentsList()
        public string Student { get; set; }
        public string Location { get; set; }
        public int Age { get; set; }
        public DateTime DOB { get; set; }
        public string Interest { get; set; }
        public string School { get; set; }
    }

标签: c#

解决方案


推荐阅读