C#: LINQ – SkipWhile to get objects

Please see my other LINQ articles.

Use SkipWhile() to include a condition for skipping objects.

In this article I’ll demonstrate how to use SkipWhile() to set a condition on which to skip objects when building a collection.

First, I’ll get a collection of static Person objects.

Now I’ll call SkipWhile() on my collection using Method syntax and only retrieve the second object – “paul” is the first name of the first object.

.NET Fiddle: LINQ: SkipWhile