in c#: expression evaluation function like flash script

后端 未结 3 1877
别那么骄傲
别那么骄傲 2020-12-21 02:20

Duplicate of: How can I evaluate a C# expression dynamically?

See also: C# eval equivalent?

How to evaluate expression. Maybe like:

int a=1;
i         


        
3条回答
  •  情歌与酒
    2020-12-21 03:10

    You can take code, and using the CSharpCodeProvider write an Eval function that actually compiles your code into an in-memory assembly and then executes that code.

    See this CodeProject article for sample source.

提交回复
热议问题