LINQ's Distinct() on a particular property

后端 未结 20 2532
一向
一向 2020-11-21 05:05

I am playing with LINQ to learn about it, but I can\'t figure out how to use Distinct when I do not have a simple list (a simple list of integers is pretty easy

20条回答
  •  没有蜡笔的小新
    2020-11-21 05:41

    You should be able to override Equals on person to actually do Equals on Person.id. This ought to result in the behavior you're after.

提交回复
热议问题