Using Take to get only the first 3 elements of the array
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}
Dim first3Numbers = From num In numbers Take 3
Console.WriteLine("First 3 numbers:")
For Each n In first3Numbers
Console.WriteLine(n)
Next
End Sub
End Class
Related examples in the same category