How can I evaluate C# code dynamically?

后端 未结 16 1941
[愿得一人]
[愿得一人] 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:08

    You also could implement a Webbrowser, then load a html-file wich contains javascript.

    Then u go for the document.InvokeScript Method on this browser. The return Value of the eval function can be catched and converted into everything you need.

    I did this in several Projects and it works perfectly.

    Hope it helps

提交回复
热议问题