1
Vote

ExpressionComparer does not support expressions with anonymous types

description

Complete example and partial solution can be find here: https://gist.github.com/2658225
 
This is what fails:
 
private static LambdaExpression ExpressionFactory(int customerNoFrom, int customerNoTo)
{
Func<Expression<Func<Customer, bool>>, LambdaExpression> fn = expression => expression;
 
return fn(c =>
        c.CustomerNo >= customerNoFrom && c.CustomerNo <= customerNoTo &&
        c.DeliveryAddress.Street == "The delivery street #544");
}
 
static void Main(string[] args)
{
var e1 = F(500, 550);
var e2 = F(500, 550);
 
var r = ExpressionComparer.AreEqual(e1, e2); //Gives false
}
 
//Daniel

comments