Element Operators ElementAt: retrieve the second number greater than 5 : ElementAt « LINQ « VB.Net Tutorial






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

Public Class MainClass
   Public Shared Sub Main

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

        'second number is index 1 because sequences use 0-based indexing
        Dim fourthLowNum = (From num In numbers Where num > 5).ElementAt(1)

        Console.WriteLine("Second number > 5: " & fourthLowNum)
   End Sub


End Class








12.7.ElementAt
12.7.1.Element Operators ElementAt: retrieve the second number greater than 5