LINQ | Partition Operator | SkipWhile
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 SkipWhile operator is used for skipping the elements based on the predicate function until the element in the given sequence does not satisfy the given condition and then return the remaining elements. This method is overloaded in two different ways:
- SkipWhile<TSource>(IEnumerable<TSource>, Func<TSource, Boolean>): This method is used to bypass the elements in a given sequence as long as a specified condition is true and then returns the remaining elements.
- SkipWhile<TSource>(IEnumerable<TSource>, Func<TSource, Int32, Boolean>): This method is used to bypass the elements in a given sequence as long as a specified condition is true and then returns the remaining elements. The index of the element is used in the logic of the predicate function.
- It does not support query syntax in C# and VB.Net languages. But you can use the SkipWhile method to query variable or you can wrap your query in brackets and then the call SkipWhile 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.
- It will throw an ArgumentNullException if the source or the condition is null.
Sequence: 67 67 76 89
Employee Name: Anu Employee Name: Anil Employee Name: Anju
My Personal Notes arrow_drop_up
Please Login to comment...