Javatpoint Logo
Javatpoint Logo

LINQ Except Method

In LINQ, the Except method or operator is used to return only the elements from the first collection, which are not present in the second collection.

Here is the pictorial representation of the LINQ Except method.

LINQ Except Method

As we see in the above figure, it will return the element from the first collection, which does not exist in the second collection.

Syntax of LINQ Except Method

The syntax of using the LINQ Except method to get the elements from the first list which does not exist in the second list.

From the above syntax, we are comparing two lists "arr1","arr2" and getting elements using the Except() method.

Example of LINQ Except Method

Here is the example of the LINQ Except method to get the element from the first collection.

Output:

LINQ Except Method




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA