Possible Duplicate:
How to check if two Expression<Func<T, bool>> are the same
I need to compare two lambda expressions, to check equality. Basicly, the two following lambda are identical:
Expression<Func<int, bool>> exp1 = (Foo f) => f.Bar().StartsWith("F");
Expression<Func<int, bool>> exp2 = (Foo b) => b.Bar().StartsWith("F");
How can I check if exp1
does the same thing that exp2
does?
In lambda expressions, the lambda operator => separates the input parameters on the left side from the lambda body on the right side.
The body of a statement lambda can consist of any number of statements; however, in practice there are typically no more than two or three.
A lambda in Java essentially consists of three parts: a parenthesized set of parameters, an arrow, and then a body, which can either be a single expression or a block of Java code.
You might need to use IComparer or mock classes
View c-sharp-lambda-expressions-and-icomparer and comparing-simple-lambda-expressions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With