【发布时间】:2013-05-03 07:36:13
【问题描述】:
我有一个 IList--->
IList<Test> list;
该列表包含 Test 类的对象,如下所示:
list.Add(new Test{ id = 1, name = "abc" })
list.Add(new Test{ id = 2, name = "xyz" })
list.Add(new Test{ id = 3, name = "nmo" })
Test 类在哪里 --->
Class Test
{
int id;
string name;
}
现在我想选择所有名称字段(列表的所有元素)--->
IList<string> nameList = ???
我陷入了困境(缺乏关于 LINQ c# 的知识)
【问题讨论】:
标签: c# linq ienumerable ilist