我使用下面的代码返回一个IList:LINQ的转换
public IList<string> FindCodesByCountry(string country)
{
var query = from q in session.Linq<Store>()
where q.Country == country
orderby q.Code
select new {q.Code};
return (IList<string>) query.ToList();
}
不过,我不断收到此错误:
无法投类型的对象System.Collections.Generic.List 1[<>f__AnonymousType0
1 [System.String]]'键入'System.Collections.Generic.IList`1 [System.String]'。
我应该回到这里吗?
哎哟.....不知道我是如何错过的......我以为我**有**使用**新**运算符返回一列。 – vikasde 2010-01-20 17:56:49