In LINQ, Set operators are those operators in query expression which return a result set which is based on the existence or non-existence of the equivalent elements within the same or different collections or sequences or sets. The standard query operator contains the following set operators:
The Distinct operator returns the set which does not contain duplicate values. Or in other words, we can say that this operator removes all the duplicate values from the set or collection and return a set or collection which contain unique or dissimilar values.
- It does not support query syntax in C# and VB.Net languages. But you can use the Distinct method on query variable or you can wrap your query in brackets and then the call Distinct method.
- It support method syntax in both C# and VB.Net languages.
- It present in both the Queryable and Enumerable class.
- It is implemented by using deferred execution.
- When you are working with the collections of complex types, then you must use IEqualityComparer interface to use Distinct method because Distinct method does not compare the values of complex types.
Sequence is: m q o s y a a c y o New Sequence: m q o s y a c
Employee Salary: 20000 30000 40000 50000
- LINQ | Set Operator | Except
- LINQ | Filtering Operator | where
- LINQ | Partition Operator | Take
- LINQ | Set Operator | Intersect
- LINQ | Set Operator | Union
- LINQ | Quantifier Operator | Contains
- LINQ | Quantifier Operator | All
- LINQ | Element Operator | First
- LINQ | Quantifier Operator | Any
- LINQ | Element Operator | Last
- LINQ | Grouping Operator | ToLooKUp
- LINQ | Grouping Operator | GroupBy
- LINQ | Element Operator | LastOrDefault
- LINQ | Element Operator | FirstOrDefault
- LINQ | Element Operator | SingleOrDefault
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.