How to get a distinct list from a List of objects?

后端 未结 10 1250
滥情空心
滥情空心 2020-12-24 04:59

I have a List someList.

class MyClass
{
    public int Prop1...
    public int Prop2...
    public int Prop3...
}
10条回答
  •  一向
    一向 (楼主)
    2020-12-24 05:14

    Create a class that implements the IEqualityComparer Interface that only checks for your Prop2-Property. You can then pass an instance of this class to the Distinct extension method.

提交回复
热议问题