Imports System
Imports System.Collections.Generic
Public Class Example
Public Shared Sub Main()
Dim letters() As String = {"A","B","A","C","D","E" }
Console.WriteLine()
For Each letter As String In letters
Console.WriteLine(letter)
Next
Console.WriteLine("Sort")
Array.Sort(letters)
Console.WriteLine()
For Each letter As String In letters
Console.WriteLine(letter)
Next
Console.WriteLine("BinarySearch for 'E':")
Dim index As Integer = Array.BinarySearch(letters, "E")
Console.WriteLine(index)
End Sub
End Class
|