METHOD

Enumerable.Intersect

Returns distinct values present in both sequences.

Formal Syntax & Structure

csharp syntaxcsharp
first.Intersect(second, comparer)

Working Example

Example Snippetcsharp
using System;using System.Linq;var q = new[] {1,2}.Intersect(new[] {2,3});
C# & .NET Reference