In LINQ, partition operators are used for separating the given sequence into two portions without sorting the elements and return one of the portions. The Standard Query Operators supports 4 different types of partition operators:
The Take operator is used to return a specified number of adjacent elements from the start of the sequences. Or in other words, we can say that it returns the specified number of items starting from the first item. As shown in the below example:
- It does not support query syntax in C# and VB.Net languages. But you can use the Take method to query variable or you can wrap your query in brackets and then the call Take method. As shown in the Example 2.
- 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.
- It will throw an ArgumentNullException if the source is null.
New Sequence: 13 45 56 67 67
Employee Name: Anjita Employee Name: Soniya Employee Name: Rohit Employee Name: Anu
- LINQ | Partition Operator | Skip
- LINQ | Partition Operator | SkipWhile
- LINQ | Partition Operator | TakeWhile
- LINQ | Set Operator | Except
- LINQ | Quantifier Operator | Contains
- LINQ | Element Operator | Last
- LINQ | Quantifier Operator | All
- LINQ | Quantifier Operator | Any
- LINQ | Filtering Operator | where
- LINQ | Set Operator | Intersect
- LINQ | Set Operator | Union
- LINQ | Set Operator | Distinct
- LINQ | Element Operator | First
- LINQ | Sorting Operator | ThenByDescending
- LINQ | Generation Operator | DefaultIfEmpty
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.