我使用下面的代碼返回一個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