Tutorial by Examples

The Take Method Takes elements up to a specified position starting from the first element in a sequence. Signature of Take: Public static IEnumerable<TSource> Take<TSource>(this IEnumerable<TSource> source,int count); Example: int[] numbers = { 1, 5, 8, 4, 9, 3, 6, 7, 2, 0 };...
Skips elements up to a specified position starting from the first element in a sequence. Signature of Skip: Public static IEnumerable Skip(this IEnumerable source,int count); Example int[] numbers = { 1, 5, 8, 4, 9, 3, 6, 7, 2, 0 }; var SkipFirstFiveElement = numbers.Take(5); Output: The ...
Returns elements from the given collection until the specified condition is true. If the first element itself doesn't satisfy the condition then returns an empty collection. Signature of TakeWhile(): Public static IEnumerable <TSource> TakeWhile<TSource>(this IEnumerable <TSource&gt...
Skips elements based on a condition until an element does not satisfy the condition. If the first element itself doesn't satisfy the condition, it then skips 0 elements and returns all the elements in the sequence. Signature of SkipWhile(): Public static IEnumerable <TSource> SkipWhile<TS...

Page 1 of 1