using System; using System.Collections; class Program { static void Main(string[] args) { ArrayList myList = new ArrayList(); myList.Add("apple"); myList.Add("banana"); myList.Add("carrot"); IEnumerator myEnumerator = myList.GetEnumerator(); while (myEnumerator.MoveNext()) { Console.WriteLine(myEnumerator.Current); } } }In the above example, we create an ArrayList and add three strings to it. We then use the GetEnumerator method to retrieve an enumerator for the ArrayList. Finally, we use a while loop to iterate through the ArrayList, printing each element to the console. The package library for the ArrayList class is System.Collections.