Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ArrayList.Reverse Method (Int32, Int32)

Reverses the order of the elements in the specified range.

Namespace:  System.Collections
Assembly:  mscorlib (in mscorlib.dll)

abstract Reverse : 
        index:int * 
        count:int -> unit  
override Reverse : 
        index:int * 
        count:int -> unit

Parameters

index
Type: System.Int32

The zero-based starting index of the range to reverse.

count
Type: System.Int32

The number of elements in the range to reverse.

ExceptionCondition
ArgumentOutOfRangeException

index is less than zero.

-or-

count is less than zero.

ArgumentException

index and count do not denote a valid range of elements in the ArrayList.

NotSupportedException

The ArrayList is read-only.

This method uses Array.Reverse to reverse the order of the elements, such that the element at ArrayList [i], where i is any index within the range, moves to ArrayList [j], where j equals index + index + count - i - 1.

This method is an O(n) operation, where n is count.

The following code example shows how to reverse the sort order of the values in a range of elements in an ArrayList.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0
Show:
© 2015 Microsoft