Ejemplo n.º 1
0
        //konstruktor
        public People(Person[] peopleArray)
        {
            //kopiujemy tablicę ludzi, którą dostajemy w konstruktorze
            _people = new Person[peopleArray.Length];

            for (var i = 0; i < peopleArray.Length; i++)
            {
                _people[i] = peopleArray[i];
            }
        }
Ejemplo n.º 2
0
 public PeopleEnum(Person[] people)
 {
     _people = people;
 }
Ejemplo n.º 3
0
        static void Main()
        {
            Person[] peopleArray = new Person[3]
            {
                new Person("John", "Smith"),
                new Person("Jim", "Johnson"),
                new Person("Sue", "Rabon")

            };

            People peopleList = new People(peopleArray);
            foreach (Person p in peopleList)
            {
                Console.WriteLine(p.ToString());
            }

            Console.Read();
        }