// C# code for testing the members of the ArrayList class
// specified in the abbreviated UML diagram for ArrayList.
public void Page_Load(object sender, EventArgs e)
{
// Test constructor
ArrayList col = new ArrayList();
// Test Add methods.
col.Add(cat);
col.Add(dog);
col.Add(mouse);
foreach (string s in col)
{
Response.Write(s + );
}
Response.Write(
Current Count = + col.Count +
);
// Test Insert method.
col.Insert(1, squirrel);
foreach (string s in col)
{
Response.Write(s + );
}
Response.Write(
Current Count = + col.Count +
);
// Test RemoveAt method.
col.RemoveAt(0);
foreach (string s in col)
{
Response.Write(s + );
}
Response.Write(
Current Count = + col.Count +
);
// Test indexer.
Response.Write(col[0] == + col[0] +
);
Response.Write(col[1] == + col[1] +
);
Response.Write(col[2] == + col[2] +
);
}