Here we will learn LINQ set operations in c#, vb.net with example and different types of LINQ set operations (union, intersect, distinct, except) in c#, vb.net with examples.
In LINQ Set Operators are used to return result set based on the presence or absence of equivalent elements within the same or separate collections.
In LINQ we have different type of set operators available those are:
These set operators will perform different operators like removing duplicate elements from the collections or combine all the elements of collections or leave some elements from collection based on our requirements.
Following table shows more details related to set operators in LINQ.
|UNION||It combine multiple collections into single collection and return resultant collection with unique elements|
|INTERSECT||It return sequence elements which are common in both the input sequences|
|DISTINCT||It removes duplicate elements from the collection and returns collection with unique values|
|EXCEPT||It returns sequence elements from first input sequence that are not present in second input sequence|
In coming chapters we will more about each set operator in detail with examples.