Mega Code Archive

 
Categories / VB.Net / Data Structure
 

Reverses the sequence of the elements in the entire one-dimensional Array

Imports System Imports Microsoft.VisualBasic Public Class SamplesArray         Public Shared Sub Main()         Dim myArray As Array = Array.CreateInstance(GetType(String), 9)         myArray.SetValue("The", 0)         myArray.SetValue("quick", 1)         myArray.SetValue("brown", 2)         myArray.SetValue("fox", 3)         myArray.SetValue("jumps", 4)         myArray.SetValue("over", 5)         PrintIndexAndValues(myArray)         Array.Reverse(myArray)         PrintIndexAndValues(myArray)     End Sub 'Main     Public Shared Sub PrintIndexAndValues(myArray As Array)         Dim i As Integer         For i = myArray.GetLowerBound(0) To myArray.GetUpperBound(0)             Console.WriteLine(myArray.GetValue(i))         Next i     End Sub End Class