Use TakeWhile with index : TakeWhile : LINQ C# Source Code


Custom Search

C# Source Code » LINQ » TakeWhile »

 

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

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo LINQ
» TakeWhile