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.
我有一个Person包含 String 字段的对象Name。我需要按字母顺序从人员列表中列出姓名。有没有更聪明的方法可以在不运行循环的情况下做到这一点。
Person
Name
您可以使用 select 和 orderby 扩展,例如:
var result = list.Select(i => i.Name).OrderBy(j => j);