111,129
社区成员
发帖
与我相关
我的任务
分享
object mObj = null;
System.Reflection.Assembly mAssemblyData = System.Reflection.Assembly.Load("SocketListening.Data");
foreach (Type mTypeData in mAssemblyData.GetTypes())
{
if ((mTypeData.Namespace + "." + mTypeData.Name) == "SocketListening.Data.T_SizeType")
{
System.Data.DataSet mDS = new System.Data.DataSet();
Object[] mParameters = new Object[3];
mParameters[0] = mObj;
mParameters[1] = mDS;
mParameters[2] = "CostacoCTNConnString";
//Activator.CreateInstance()调用类的缺省构造函数来创建实例
object mDataInstance = System.Activator.CreateInstance(mTypeData);
//利用MethodInfo类来获得从指定类中的成员函数
System.Reflection.MethodInfo mMI = mTypeData.GetMethod("pro_T_SizeType_SelectAll");
//调用此成员函数
mMI.Invoke(mDataInstance, mParameters);
mDS = (System.Data.DataSet)mParameters[1];
break;
}
}
public class T_SizeType
{
public bool pro_T_SizeType_SelectAll(SocketListening.Entity.T_SizeType entity, ref System.Data.DataSet p_DS, string p_ConnString)
{
return true;
}
}
public class T_SizeType
{
public static bool pro_T_SizeType_SelectAll(SocketListening.Entity.T_SizeType entity, ref System.Data.DataSet p_DS, string p_ConnString)
{
return true;
}
}
public class T_SizeType
{
public static bool pro_T_SizeType_SelectAll(T_SizeType entity, ref System.Data.DataSet p_DS, string p_ConnString)
{
return true;
}
}
class Program
{
static void Main(string[] args)
{
object[] arg = new object[3]{new T_SizeType(),new System.Data.DataSet(),string.Empty};
typeof(T_SizeType).InvokeMember("pro_T_SizeType_SelectAll",
BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod, null, null, arg);
}
}