Imports System
Public Class SamplesArray
Public Shared Sub Main()
Dim myIntArray As Array = Array.CreateInstance( GetType(Int32), 5 )
myIntArray.SetValue( 8, 0 )
myIntArray.SetValue( 2, 1 )
myIntArray.SetValue( 6, 2 )
myIntArray.SetValue( 3, 3 )
myIntArray.SetValue( 7, 4 )
Array.Sort(myIntArray)
PrintValues(myIntArray)
Dim myObjectOdd As Object = 1
FindMyObject(myIntArray, myObjectOdd)
End Sub
Public Shared Sub FindMyObject(myArr As Array, myObject As Object)
Dim myIndex As Integer = Array.BinarySearch(myArr, myObject)
Console.WriteLine(myIndex)
End Sub
Public Shared Sub PrintValues(myArr As Array)
Dim i As Integer = 0
For Each o As Object In myArr
Console.WriteLine( "{0}", o)
Next o
End Sub
End Class