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

[Feature Request] Generic Type parameter for Expression in visit method #13

Open
SpaceOgre opened this issue Sep 23, 2022 · 1 comment

Comments

@SpaceOgre
Copy link

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)
@Thorium
Copy link
Owner

Thorium commented Mar 8, 2023

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.

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

2 participants