SkipWhile with index : SkipWhile : LINQ C# Source Code


Custom Search

C# Source Code » LINQ » SkipWhile »

 

SkipWhile with index








    
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass{
public static void Main() {

            int[] numbers = { 5, 4, 8, 6, 7, 2, 0 };
            
            var laterNumbers = numbers.SkipWhile((n, index) => n >= index);
            
            Console.WriteLine("All elements starting from first element less than its position:");
            foreach (var n in laterNumbers) {
                Console.WriteLine(n);
            }
        }

}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo LINQ
» SkipWhile