c#反射执行静态方法

反射调用System.Environment.Exit(0)示例:

System.Reflection.Assembly ass = System.Reflection.Assembly.LoadFile(AppDomain.CurrentDomain.BaseDirectory+"\xxx.dll"); 
//命名空间和类的名字必须一起指定
Type type = ass.GetType("System.Environment");



object obj = type.InvokeMember("Exit",
System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Static
| System.Reflection.BindingFlags.Public, null, null,
new object[] {0});  //最后一个是参数:0

From:http://www.cnblogs.com/xuejianxiyang/p/7527228.html

原文地址:https://www.cnblogs.com/xuejianxiyang/p/7527228.html