我有一个具有 3 个属性的类(ApplicationHistory):
申请者 ID、提供者 ID、申请日期
我将数据库中的数据返回到一个列表中,但是这包含重复的申请者 ID/提供者 ID 键。
我想取消该列表,以便该列表仅包含每个申请人 ID/ProviderId 的最早申请日期。
下面的示例是我目前所在的位置,但我不确定如何确保返回最早的日期。
var supressed = history
.GroupBy(x => new
{
ApplicantId = x.ApplicantId,
ProviderId = x.ProviderId
})
.First();
所有建议表示赞赏。