Get specific property from all items from the list

You want to use the Select method, not Where here:

_contactList.Select(C => C.FirstName).ToList();

Further, the need for the ToList() only exists because the property demands it. You could return an IEnumerable<string> instead if you wanted to get rid of that.

Leave a Comment