c# - How do Linq Expressions determine equality? -


i considering using linq expression key in dictionary. however, concerned strange results, because don't know how equality determined linq expressions.

does class derived expression compare value equality or reference equality? or in other words,

        expression<func<object>> first = () => new object();          expression<func<object>> second = ()=>new object();         bool aretheyequal = first == second; 

your test compares expressions. expressions offer reference equality; test show "false". cheek semantic equality need lot of work, example - are:

x => 123 

and

y => 123 

equivalent? crude test can compare tostring(), exceptionally brittle.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -