Linq.Expression.Optimizer
Linq.Expression.Optimizer copied to clipboard
[Feature Request] Generic Type parameter for Expression in visit method
Description
It would be nice if the visit method got a generic type overload, so I don't have to cast the expression returned.
return (Expression<Func<Models.Organisation.EducationEvent, bool>>)ExpressionOptimizer.visit(expression);
Not sure how it would look in F# but something like this in C#
public Expression<T> visit<T>(Expression<T> expression)
I was looking this at some point, but the typical way of working with Linq expression trees is that they are visited and re-constructed recursively, and there is no easy way to carry the generic type parameters through-out the full expression tree traversal, so some level cast has to happen anyway. That's why I thought it's probably better that the user explicitly does it.
I decided to add this anyway, as visitTyped.