Array.Reverse Method (Array, Int32, Int32)
.NET Framework (current version)
Reverses the sequence of the elements in a range of elements in the one-dimensional Array.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- array
-
Type:
System.Array
The one-dimensional Array to reverse.
- index
-
Type:
System.Int32
The starting index of the section to reverse.
- length
-
Type:
System.Int32
The number of elements in the section to reverse.
| Exception | Condition |
|---|---|
| ArgumentNullException | array is null. |
| RankException | array is multidimensional. |
| ArgumentOutOfRangeException | index is less than the lower bound of array. -or- length is less than zero. |
| ArgumentException | index and length do not specify a valid range in array. |
After a call to this method, the element at myArray[i], where i is any index in the array, moves to myArray[j], where j equals (myArray.Length + myArray.GetLowerBound(0)) - (i - myArray.GetLowerBound(0)) - 1.
TheReverse method can be used to reverse a jagged array.
This method is an O(n) operation, where n is length.
Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Show: