LINQ | Partition Operator | Take
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
My Personal Notes arrow_drop_up
Please Login to comment...