CKTIS / C#
Enumerable.SkipWhile: practical reference
Enumerable.SkipWhile: practical reference: Skips initial elements while the predicate is true; after the first false it returns every remaining element without skipping again.
Version: .NET LINQ; verified on .NET 10.0.14
Syntax
source.SkipWhile(/* overload-specific arguments */)Skips initial elements while the predicate is true; after the first false it returns every remaining element without skipping again.
Use it to remove a prefix, not to filter all elements.
An element satisfying the condition after the first false remains. The indexed predicate counts source positions.
An empty source yields an empty result. A null source or predicate causes ArgumentNullException.
The complete program actually uses Enumerable.SkipWhile; its exact expected stdout is 5,2.
Examples
using System;
using System.Collections.Generic;
using System.Linq;
Console.WriteLine(string.Join(",", new[] { 1, 2, 5, 2 }.SkipWhile(value => value < 5)));
Result
5,2
The complete program actually uses `Enumerable.SkipWhile`; its exact expected stdout is `5,2`.