悬赏园豆:15
[已解决问题]
解决于 2008-06-04 13:47
<P>这个反射是该怎么写的呀?</P>
<P>Register是CommonUserOperation类下的方法,ICommonUser接口</P>
<P>CommonUserProperty继承了这个接口, </P>
<P>,我想用反射得到所有属性值,</P>
<P>红颜色 Load()该怎么写呀?我看了MSDN要加引用,不明白,请指点。</P>
<P>public bool Register(ICommonUser user)<BR> {<BR> <FONT color=#ff0000>Assembly theAssembly = Assembly.Load(user.ToString());<BR></FONT> if (theAssembly == null) return false;<BR> Type type = theAssembly.GetType();<BR> PropertyInfo[] myProperty = type.GetProperties();<BR> object[] param = new object[myProperty.Length];<BR> //param = myProperty.CopyTo(param, 0);<BR> for (int i = 0; i < myProperty.Length; i++)<BR> {<BR> param[i] = myProperty[i].GetValue(myProperty, null);<BR> }<BR> DiseaseDetails dis = new DiseaseDetails();<BR> return (bool)dis.Execute("CommonUserRegister", "int", param);<BR> }</P>
<P>上面代码调用时出错:"未能加载文件或程序集“UserRegister.CommonUserProperty”或它的某一个依赖项。系统找不到指定的文件。"</P>