我正在尝试将以下查询返回到字符串数组:
select top 10 c_initials, MAX(c_score) as MaxScore
from t_bisGame
group by c_initials order by MaxScore desc
[WebMethod]
public string[] GetMyGameList()
{
//LINQ
}
我不断遇到:
无法将类型“AnonymousType#1[]”隐式转换为“string[]”
使用以下代码
var employees = from e in db.t_bisGames
group e by e.c_Initials into egrp
let max = egrp.Max(scor => scor.c_Score)
select new
{
Name = egrp.First(val => val.c_Score == max).c_Initials.ToArray(),
Score = egrp.First(val => val.c_Score == max).c_Score.ToString().ToArray()
};