c# - Cannot resolve method between Enumerable and Queryable candidates -
i have method in class called invoice:
public static expression<func<invoice, bool>> isallocated() { return => i.totalamountdue == i.getallocationstotal(); } i have list this:
iqueryable<invoice> invoices and need filter (it's linq entity):
var filteredinvoices = invoices.where(i => invoice.isallocated()); in line i'm getting 2 errors:
cannot resolve method ... candidates .... 1 in enumerable , other on in queryable.
and also:
cannot convert expression type
expression<func<invoice,bool>>return type 'bool'
i've tried lot of things i've found in no luck. can me missing here or @ least, 1 of 2 errors @ root of problem?
your method returns appropriate expression tree - need call it, not call in lambda expression:
var filteredinvoices = invoices.where(invoice.isallocated());
Comments
Post a Comment