Hello,
Is there a way to get a property of an object in an IEnumerator list with an index ?
Normally , if we have this structure :
Person[] peopleArray = new Person[3]
{
new Person("John", "Smith"),
new Person("Jim", "Johnson"),
new Person("Sue", "Rabon"),
};
People peopleList = new People(peopleArray);
the only way to access to the fileds is by using
foreach (Person p in peopleList)
Console.WriteLine(p.firstName+ " " + p.lastName);
}
so my question is :
how can we access to the field with somtthing like this
foreach (Person p in peopleList)
Console.WriteLine(p[0] + " " + p[1]); ???
}
plz to help
Tapan PatelPosted Sep 2, 2016, 9:01 AM
radouane ziliPosted Sep 2, 2016, 7:29 AM
Vinay SinghPosted Sep 2, 2016, 7:25 AM