2

如果我有学生对象列表

var List<Student> = new List<Student>();

这是学生对象数据(ID,名称)

如何仅使用 Linq To Entities 提取学生 ID 列表

请指教,

4

1 回答 1

3

只需使用Enumerable.Select

List<int> studentIDs = students.Select(s => s.ID)
                               .ToList();

(虽然我不确定它与 linq-to-entities 有什么关系)

于 2013-01-30T12:17:22.133 回答