C#: LINQ – Distinct to get unique values

Please see my other Web articles.

Use Distinct() during select to retrieve a unique list.

In this article I’ll demonstrate how to use Distinct() during Select() to generate a unique list of car makes.

First, I’ll get a collection of static Car objects.

In the section statement, I perform a select on the car objects’ Make property, then Distinct() to limit the result set to a unique list of car makes.

.NET Fiddle: LINQ: Distinct