This documentation is archived and is not being maintained.

How to: Reverse the Contents of An Array in Visual Basic

This example declares an array of String objects named zooAnimals, populates it, and then reverses its contents.

This code example is also available as an IntelliSense code snippet. In the code snippet picker, it is located in Visual Basic Language. For more information, see How to: Insert IntelliSense Code Snippets.

Public Sub reverseAnimals()
    Dim zooAnimals(2) As String
    zooAnimals(0) = "lion"
    zooAnimals(1) = "turtle"
    zooAnimals(2) = "ostrich"
End Sub

This example requires:

  • Access to Mscorlib.dll and the System namespace.

The following conditions may cause an exception: