Use SkipWhile with index : SkipWhile « LINQ « C# / C Sharp






Use SkipWhile with index

 
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);
    }
}

 








Related examples in the same category

1.SkipWhile with condition
2.SkipWhile with index
3.SkipWhile Prototype
4.Second SkipWhile Prototype