Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compare property expression of inherited class #28

Open
samuelpsfung opened this issue Oct 6, 2020 · 0 comments
Open

compare property expression of inherited class #28

samuelpsfung opened this issue Oct 6, 2020 · 0 comments

Comments

@samuelpsfung
Copy link

public class BaseClass
{
    public int ID { get; set; }
}

public class SubClass : BaseClass
{ }

var param = Expression.Parameter(typeof(SubClass));
var body = Expression.Property(param, "ID");
var lambda = Expression.Lambda<Func<SubClass, int>>(body, param);

Expression<Func<SubClass, int>> lambdaExpr = x => x.ID;
Console.WriteLine(ExpressionComparer.AreEqual(lambda, lambdaExpr));

These 2 lambdas should be equal, but ExpressionComparer.AreEqual() returns false.

This issue should be related to this question:
https://stackoverflow.com/questions/13615927/equality-for-net-propertyinfos#13616025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant