+92 332 4229 857 99ProjectIdeas@Gmail.com

LINQ SkipWhile() Method (Vb.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.







Dim numbers() As Integer = {59, 82, 70, 56, 92, 98, 85}
      
Dim query As IEnumerable(Of Integer) = _
    numbers.OrderByDescending(Function(a) a) _
    .SkipWhile(Function(a) a >= 80)

    For Each i In query
        Console.Write(i.ToString() & " ")
    Next

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

see this in c#.net

0 comments: