//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]; } }
public PeopleEnum(Person[] people) { _people = people; }
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(); }