Use SkipWhile to skip based on a user function in CSharp

Description

The following code shows how to use SkipWhile to skip based on a user function.

Example


  //from  w w  w  . j  a v a  2  s  . com
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;

public class MainClass{
   public static void Main(){
       int[] numbers = { 1, 3, 5, 4};
       var query = numbers.TakeWhile(( n, index) => n >= index);

       var query2 = numbers.SkipWhile(( n, index) => n >= index);
    }
}




















Home »
  C# Tutorial »
    LINQ »




Operator
Select
Where
OrderBy
Group
Join
Let
LINQ