Given a method signature:
public bool AreTheSame<T>(Expression<Func<T, object>> exp1, Expression<Func<T, object>> exp2)
What would be the most efficient way to say if the two expressions are the same? This only needs to work for simple expressions, by this I mean all that would be ‘supported’ would be simple MemberExpressions, eg c => c.ID.
An example call might be:
AreTheSame<User>(u1 => u1.ID, u2 => u2.ID); --> would return true
Hmmm… I guess you’d have to parse the tree, checking the node-type and member of each. I’ll knock up an example…