简体   繁体   English

如何用字符串(文本)WPF制作方法

[英]How to make a method from a string(Text) WPF

I'm new in programing in WPF and I'm working on an application that uses AvalonEdit to make a script and get a string like this: 我是WPF编程的新手,并且正在使用AvalonEdit编写脚本并获取如下字符串的应用程序:

  "Task1Init
       Do Function1 (Argument 1)
       Do Function2 (Argument 2)
       Do Function3 (Argument 3)
   End"

Then I modify the string and get a Method like this: 然后,我修改字符串并获得如下方法:

"public void Task1(){
     Function1(A1);
     Function2(A2);
     Function3(A3);
}"

In this case all the functions are defined in a file AviliableFunctions.cs. 在这种情况下,所有功能都在文件AviliableFunctions.cs中定义。

If I want to Run the Task1(), What will be the best way to convert the String into C# Code?, I have been searching and found the tool roslyn, but I'm not sure if it can be used to do this. 如果我想运行Task1(),将String转换为C#代码的最佳方法是什么?,我一直在搜索并找到工具roslyn,但不确定是否可以使用它来执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM