首页 > 代码库 > [C#]反射相关

[C#]反射相关

 //Type type = DataHelper.Instance.GetType();
            //MethodInfo[] infos = type.GetMethods(BindingFlags.Instance | BindingFlags.Public);

            Assembly ass = System.Reflection.Assembly.LoadFrom(@"D:\DBHelper.dll");
            //Type type = ass.GetType("DBHelper.SqlConn");
            Type type = ass.GetType("DBHelper.Datahelper",false,true);
            MemberInfo[] infos = type.GetMembers();

            //object reflectTest = Activator.CreateInstance(type,false);
            //MethodInfo info = type.GetMethod("GetConn", new Type[] { typeof(string) });

            //string conn = (string)info.Invoke(reflectTest, new string[] { "D" });
            
            //string conn = DBHelper.SqlConn.GetConn("D");

            //DataTable dt = DataHelper.Instance.GetDataTable("select * from C", "D");

 

[C#]反射相关