C# does not have an eval function to evaulate a string expression and give you its value. However there are ways to achieve this. Refer the following threads for reference.
https://stackoverflow.com/questions/4629/how-can-i-evaluate-c-sharp-code-dynamically
https://odetocode.com/articles/80.aspx
https://learn.microsoft.com/en-us/answers/questions/404191/does-c-has-function-like-eval.html
Hope this helps