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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)