Mega Code Archive

 
Categories / C# / Collections Data Structure
 

Reverses the order of the elements in the specified range

using System; using System.Collections.Generic; public class Example {     public static void Main()     {         List<string> myList = new List<string>();         myList.Add("A");         myList.Add("B");         myList.Add("C");         Console.WriteLine();         foreach (string d in myList)         {             Console.WriteLine(d);         }         myList.Reverse();         Console.WriteLine();         foreach (string d in myList)         {             Console.WriteLine(d);         }         myList.Reverse(1, 4);         Console.WriteLine();         foreach (string d in myList)         {             Console.WriteLine(d);         }     } }