ArrayList numbers = new ArrayList(); numbers.Add(1); numbers.Add(2); numbers.Add(3);
ArrayList cities = new ArrayList(); cities.Add("New York"); cities.Add("London"); cities.Add("Paris");In this example, an ArrayList is created to store strings and the Add method is used to add three cities to the ArrayList. These examples use the System.Collections namespace, which is a part of the .NET framework.