Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
认为
class Person { string FirstName; string LastName; int Age; }
和一份清单
List<Person> listPerson;
获取此列表中所有人的名字的可能方法
我认为你最简单的方法是
List<string> firstNames = listPerson.Select(p => p.FirstName).ToList()
但为了做到这一点,您需要公开这些属性。