Array.Reverse Method


Array.Reverse Method

Class

System.Array

Syntax

     Array.Reverse(array[, startindex, endindex]) 


array (required; any array)

The array to be reversed


startIndex (optional; Integer)

The index at which to start the reversal process


endIndex (optional; Integer)

The index at which to end the reversal process

Description

The Reverse method reverses a portion of, or all of, the elements of an array.

Example

     Dim counter As Integer     Dim dataSet(  ) As Integer = {1, 2, 3, 4, 5}     Array.Reverse(dataSet, 1, 3)     For counter = 0 To 4        Debug.Write(dataSet(counter))     Next counter 

This code prints the sequence 14325, which is the original array 12345 with the middle section from index 1 to index 3 reversed.

See Also

Array Class, Array.Sort Method




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net