c# - Member access not legal on type LINQ error -
c# - Member access not legal on type LINQ error -
i'm getting next error:
member access 'system.nullable1[system.int32] pointsgained' of 'supergoalsqldatabase.triviacode' not legal on type 'system.collections.generic.list
1[supergoalsqldatabase.triviacode].
here code:
public list<user> getleaderboard() { supergoaldataclassesdatacontext mydb = new supergoaldataclassesdatacontext(); var userresults = (from u in mydb.users u.firstname != null && u.lastname != null orderby (fillusercodes(u).sum(co => co.pointsgained ?? 0)) select u).take(100); list<user> users = new list<user>(); foreach (var usr in userresults) { if(usr.mypoints > 0) users.add(usr); } homecoming users; }
any , help appreciated
try:
public list<user> getleaderboard() { supergoaldataclassesdatacontext mydb = new supergoaldataclassesdatacontext(); homecoming mydb.users.where(u=> u.firstname != null && u.lastname != null).asenumerable() .orderby(u=> fillusercodes(u).sum(co => co.pointsgained ?? 0)) .take(100).where(u=> u.mypoints > 0).tolist(); }
c# linq
Comments
Post a Comment