如何在运行时编译中向Method发送参数

时间:2012-04-30 15:26:04

标签: c# runtime-compilation

我根据帖子在visual studio 2010中制作了一个C#项目:

http://www.blackwasp.co.uk/RuntimeCompilation_1.aspx

我想读取一个txt文件并将参数发送到一个方法然后得到结果。 现在我的问题是如何在运行时编译中向Method发送参数或参数?

1 个答案:

答案 0 :(得分:1)

http://www.blackwasp.co.uk/RuntimeCompilation_2.aspx有一个使用反射调用方法的示例。您要做的是Invoke方法,例如object result = myMethod.Invoke(null, myParam);并查看result