Reverses a sub range ArrayList in CSharp
Description
The following code shows how to reverses a sub range ArrayList.
Example
using System;// w w w . j a v a 2 s . c o m
using System.Collections;
public class SamplesArrayList {
public static void Main() {
ArrayList myAL = new ArrayList();
myAL.Add( "1" );
myAL.Add( "2" );
myAL.Add( "3" );
myAL.Add( "4" );
myAL.Add( "5" );
myAL.Add( "6" );
myAL.Add( "7" );
myAL.Add( "8" );
myAL.Add( "9" );
foreach ( Object obj in myAL ){
Console.WriteLine(obj );
}
myAL.Reverse( 1, 3 );
foreach ( Object obj in myAL ){
Console.WriteLine(obj );
}
}
}
The code above generates the following result.