예제 #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];
            }
        }
예제 #2
0
 public PeopleEnum(Person[] people)
 {
     _people = people;
 }
예제 #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();
        }