static void Main(string[] args) { Console.WriteLine("***** Fun with Indexers *****\n"); PeopleCollection myPeople = new PeopleCollection(); myPeople["Homer"] = new Person("Homer", "Simpson", 40); myPeople["Marge"] = new Person("Marge", "Simpson", 38); Person homer = myPeople["Homer"]; Console.WriteLine(homer.ToString()); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("**** Fun with indexers ****"); PeopleCollection myPeople = new PeopleCollection(); myPeople["homer"] = new Person("Homer", "Simpson", 59); myPeople["marge"] = new Person("Marge", "Simoson", 49); Person homer = myPeople["homer"]; Console.WriteLine(homer.ToString()); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("***** Fun with Indexers *****\n"); PeopleCollection myPeople = new PeopleCollection(); myPeople["Homer"] = new Person("Homer", "Simpson", 40); myPeople["Marge"] = new Person("Marge", "Simpson", 38); // Get "Homer" and print data. Person homer = myPeople["Homer"]; Console.WriteLine(homer.ToString()); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("***** Fun with Indexers *****\n"); PeopleCollection myPeople = new PeopleCollection(); myPeople["Homer"] = new Person("Homer", "Simpson", 40); myPeople["Marge"] = new Person("Marge", "Simpson", 38); // Get 'Homer' and print data. Person p = myPeople["Homer"]; Console.WriteLine(p); // Now get 'Marge'. p = myPeople["Marge"]; Console.WriteLine(p); Console.ReadLine(); }