コード例 #1
0
        static void Main(string[] args)
        {
            PersonCollection pc = new PersonCollection();
            pc[0] = new Person("Ujjwal", 23);
            pc[1] = new Person("Swati", 22);
            pc[2] = new Person("Surabhi", 22);

            foreach (Person p in pc)
            {
                p.Display(p);
            }

            Console.ReadKey();
        }
コード例 #2
0
 public void Display(Person p)
 {
     Console.WriteLine("Person's name is {0} and age is {1}",p.Name,p.Age);
 }