Visual Studio Blog

The official source of product insight from the Visual Studio Engineering Team

How to use LINQ methods to compare objects of custom types

LINQ provides a convenient syntax and many useful methods for operating with collections of objects. However, to be correctly processed by LINQ comparison methods such as Distinct or Intersect, a type must satisfy certain requirements.Let’s take a look at the Distinct method, which returns all distinct objects from a collection.List<...