Imports System.Collections
Public Class Tester
Shared Sub Main()
Dim integerValues As Integer() = {1, 2, 3, 4, 5, 6}
Dim integerElement As Integer
For Each integerElement In integerValues
Console.WriteLine(integerElement)
Next
Dim result As Integer = Array.BinarySearch(integerValues, 5)
If result >= 0 Then
Console.WriteLine("5 found at element " & result &" in integerValues")
Else
Console.WriteLine("5 not found" & " in integerValues")
End If
End Sub
End Class
|