The problem is that your query is returning 2 items, not just a string. Your LINQ is likely doing the same, and returning an anonymous type containing the initials and MaxScore
as properties.
You can convert this to a string array via a second mapping operation (Select
) at the end:
public string[] GetMyGameList()
{
var query = db.BisGame.GroupBy(bg => bg.Initials)
.Take(10)
.Select(g => new { Initial = g.Key, MaxScore = g.Max(bg => bg.Score) });
// Convert to string[] somehow, ie:
return query.AsEnumerable().Select(i => string.Format("{0}:{1}", i.Initial, i.MaxScore)).ToArray();
}