我如何从查询中定义并明确告诉编译器我想要一个 AnonymousType 列表?
我不想使用“var”关键字
如下示例:
List<string> query = // Explicit getting a List<string>
(from l in listTest
select l).ToList();
这就是我想要做的:
var query2 = // I would like to use List<´a> instead of var
(from l in listTest
select new
{
_string = l,
Lenght = l.Length
}).ToList();