Mega Code Archive

 
Categories / VB.Net / Data Structure
 

Reverses the order of the elements in a range

Imports System Imports System.Collections Public Class SamplesArrayList     Public Shared Sub Main()         Dim myAL As New ArrayList()         myAL.Add("A")         myAL.Add("B")         myAL.Add("C")         myAL.Add("D")         myAL.Add("E")         myAL.Add("F")         PrintValues(myAL)         myAL.Reverse(1, 3)         PrintValues(myAL)     End Sub     Public Shared Sub PrintValues(myList As IEnumerable)         Dim obj As [Object]         For Each obj In  myList             Console.WriteLine("   {0}", obj)         Next obj         Console.WriteLine()     End Sub End Class