In C#, is it possible to call a function inside of a lambda
expression?
For example, here are some contents of lambda
expression:
(a => a.testBool && a.testBool2)
Is it possible to write the above contents into a function, and call the function inside of the lambda
expression to get the same results?
Thanks in advance.
EDIT
In my original post, I did not state that this is for a dbSet.
I have created the following function in the test object (a) as follows:
public bool testBool()
{
return true;
}
When calling the following code:
(a => a.testBool()).ToList()
I am getting this error:
LINQ to Entities does not recognize the method 'Boolean testBool()' method, and this method cannot be translated into a store expression.