c# - blank is a 'variable' but is used like a 'method' - why am I getting this? -
i have list of cleaners (linq class) trying remove 'cleaners if unconfirmed. here code.
list<confirmcleaner> unconfirmed = context.confirmcleaners.where(d => d.confirmed == false).tolist(); list<cleaner> cleaners = context.cleaners.tolist(); list<cleaner> tempcleaners = new list<cleaner>(); foreach (var c in unconfirmed) { foreach(var r in cleaners){ if(c.cleanerid == r.id){ tempcleaners.add(r); } } } list<cleaner> result = cleaners().except(tempcleaners()).tolist(); return result;
why getting error :
'cleaners' 'variable' used 'method'
the problem line:
list<cleaner> result = cleaners().except(tempcleaners()).tolist();
you need change to:
list<cleaner> result = cleaners.except(tempcleaners).tolist();
Comments
Post a Comment