Can I use Linq's Except() with a lambda expression comparer?

后端 未结 7 1550
暗喜
暗喜 2020-12-01 20:55

I know I can call linq\'s Except and specify a custom IEqualityComparer, but implementing a new Comparer class for each data type seems like an overkill for this purpose. Ca

7条回答
  •  时光说笑
    2020-12-01 21:25

    I don't think you can directly with the basic LINQ interfaces, but I've seen people implement a LambdaComparer class with extension methods which will help you do it.

    Here's an example

提交回复
热议问题