Can you create a simple 'EqualityComparer' using a lambda expression

前端 未结 8 1481
半阙折子戏
半阙折子戏 2020-12-13 18:20

Short question:

Is there a simple way in LINQ to objects to get a distinct list of objects from a list based on a key property on the objects.

8条回答
  •  臣服心动
    2020-12-13 18:53

    implement IEquatable on GalleryImage because it is generated

    A different approach would be to generate GalleryImage as a partial class, and then have another file with the inheritance and IEquatable, Equals, GetHash implementation.

提交回复
热议问题