using System.Collections;
public class TestStudent
{
public static void main(String args [])
{
ArrayList students = new ArrayList();
Student rose = new Student("rose",25,"reading");
Student jack = new Student("jack",28,"singing");
Student mimi = new Student("mimi",26,"dancing");
students.add(rose);
students.add(jack);
students.add(mimi);
int number = students.Count;
Console.WriteLine("共有元素" + number + "个");
Student stu = students[0] as Student;
stu.say();
for(int i = 0;i < students.Count;i ++)
{
Student a = students[i] as Student;
a.say();
}
foreach(Object o in students)
{
Student b = o as Student;
b.say();
}
students.removeAt(0);
students.remove(jack);
students.Clear();
int number = students.Capacity;
students.TrimtoSize();
}
}