使用 反射技术调用类的方法

来源:互联网 发布:linux 常用服务端口 编辑:程序博客网 时间:2024/06/10 14:48

using System.Reflection;


            System.Reflection.Assembly test = System.Reflection.Assembly.GetExecutingAssembly();
            object obj = test.CreateInstance("zhong", true);
            Type t = typeof(zhong);


            DataSet ds2 = (DataSet)t.InvokeMember("GetAllData", BindingFlags.InvokeMethod, null, obj, null);

原创粉丝点击