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

Is there a way to get type of value that expression returns? #128

Open
KrakenEngineer opened this issue Apr 27, 2024 · 2 comments
Open

Is there a way to get type of value that expression returns? #128

KrakenEngineer opened this issue Apr 27, 2024 · 2 comments

Comments

@KrakenEngineer
Copy link

I need to know the type of value that the expression returns before doing any calculations. Is this possible if I know the type of each parameter? No, I can't just put default values like zero and evaluate because that might result in division by zero or something like that

@gumbarros
Copy link
Member

Unfortunately due do the dynamic nature of NCalc, the function signature returns object and there is no way to know the return type. Maybe you can write extensions using generics (<T>) to constraint return types.

@gumbarros
Copy link
Member

gumbarros commented Apr 27, 2024

image

The closest way to find out would be to compile an expression.

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

No branches or pull requests

2 participants