Hi all
Assuming I have a method which accepts an IList or similar thing as a parameter:
public void JiggleMyList(IList<string> list)...
Is there an easy way that I can pass in string members of a list of objects?
I mean, if for example, I have a list of Person objects which expose a string property called FullName, is there a quick way to stuff the FullNames of all the Person objects into the method parameter, or do I have to create a new List and iterate through the Person objects:
List<string> fullNames = new List<string>;
foreach (Person person in people)
{
fullNames.Add(person.FullName);
}
JiggleMyList(fullNames);
I come across this all the time, and it would be nice if there was a shortcut.
Many thanks
David