Possible Duplicate:
Most efficient way to test equality of lambda expressions
How to check if two Expression<Func<T, bool>> are the same
How to test that two expressions are the same like this sample
string firstname = "Ahmed";
Expression<Func<string, bool>> exp1 = (s) => s.Contains(firstname);
Expression<Func<string, bool>> exp2 = (s) => s.Contains(firstname);
Console.WriteLine(exp1 == exp2);//print false as two references are no equal
now how to ensure that expression1 equals to expression2 , as they have the same criteria?
Here is the code for
ExpressionEqualityComparerwhich can show how to do it.https://source.db4o.com/db4o/trunk/db4o.net/Db4objects.Db4o.Linq/Db4objects.Db4o.Linq/Expressions/