+92 332 4229 857 99ProjectIdeas@Gmail.com

LINQ SkipWhile() Method (C#.net)



LINQ SkipWhile() Method (C#.net):
The following code shows you how you can skip the elements applying some condition on array. applying LINQ SkipWhile() method you can skip those elements that you dont want. See the code below.

Code

int[] array = {59, 82, 70, 56, 92, 98, 85};

IEnumerable<int> query =
           array.OrderByDescending(x => x).SkipWhile(x => x >= 80);

   foreach (var item in query)
        Console.Write(item + " ");



Output of the program is:
70 59 56 (elements greater than 80 are skipped) 
 


Related Articles:

0 comments: