using System; using System.Collections; namespace Collections { class Program { static void Main(string[] args) { ArrayList intArray = new ArrayList(); // Populate the arraylist for (int i = 0; i < 5; i++) { intArray.Add((i + 1) * 10); } //Print each member of the ArrayList foreach (int i in intArray) { Console.Write("{0} ", i.ToString()); } Console.WriteLine("\nNow the list is reversed "); // Reverse the order of the items in the list and display them intArray.Reverse(); foreach (int i in intArray) { Console.Write("{0} ", i.ToString()); } Console.WriteLine("\nNow the order of the list has been sorted "); // Sort the items in the list and display them intArray.Sort(); foreach (int i in intArray) { Console.Write("{0} ", i.ToString()); } Console.WriteLine("\nNow the list has been cleared "); // Clear the items in the list and display them intArray.Clear(); if ((intArray.Count) == 0) { Console.WriteLine("There are nolonger any items in this list"); } System.Console.ReadKey(); } } }