How can I evaluate C# code dynamically?

后端 未结 16 1953
[愿得一人]
[愿得一人] 2020-11-22 03:37

I can do an eval(\"something()\"); to execute the code dynamically in JavaScript. Is there a way for me to do the same thing in C#?

An example of what I

16条回答
  •  忘了有多久
    2020-11-22 04:15

    Unfortunately, C# doesn't have any native facilities for doing exactly what you are asking.

    However, my C# eval program does allow for evaluating C# code. It provides for evaluating C# code at runtime and supports many C# statements. In fact, this code is usable within any .NET project, however, it is limited to using C# syntax. Have a look at my website, http://csharp-eval.com, for additional details.

提交回复
热议问题