Alternative syntax for Take While : Take « LINQ « VB.Net






Alternative syntax for Take While

  

Imports System.IO
Imports System.Reflection
Imports System.Linq
Imports System.Xml.Linq

Public Class MainClass
   Public Shared Sub Main

        Dim numbers() As Integer = {5, 4, 1, 3, 9, 8, 6, 7, 2, 0}


        'Dim firstNumbersLessThan6 = numbers.TakeWhile(Function(n) n < 6)

        Console.WriteLine("First numbers less than 6:")
        For Each n In numbers
            Console.WriteLine(n)
        Next


   End Sub


End Class

   
    
  








Related examples in the same category

1.Get the top 5 memory-using applications currently loaded
2.Indexed Take While
3.Using Take to get only the first 3 elements of the array
4.Take Partitioning