Exemplo n.º 1
0
        static void Main(string[] args) {
            PersonCollection myPeople = new PersonCollection();

            myPeople["Homer"] = new Person("Homer", "Simpson", 40);
            myPeople["Marge"] = new Person("Marge", "Simpson", 38);

            Person homer = myPeople["Homer"];
            Console.WriteLine(homer);

            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main( string[] args )
        {
            Console.WriteLine("***** Fun with Indexers *****\n");

            PersonCollection myPeople = new PersonCollection();

            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();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("***** Fun with Indexers *****\n");

            PersonCollection myPeople = new PersonCollection();

            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();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Fun with tring indexers");

            PersonCollection myPeople = new PersonCollection();

            myPeople["Homer"] = new Person("Homer", "Simpson", 40);
            myPeople["Marge"] = new Person("Marge", "Simpson", 38);

            foreach (var person in myPeople)
            {
                Console.WriteLine(person.ToString());
            }
            //get homer and print data
            Person homer = myPeople["Homer"];

            Console.WriteLine(homer.ToString());
            Console.Read();
        }