日期:2014-05-20  浏览次数:20862 次

关于C#中给dll传递参数的问题,请大家帮忙看看!!!!100分相送!!
我有一dll,在动态调用的时候,需要传递一个结构变量的地址(引用)给dll,

例如下面的简单例子代码

                        structLib.Class1.testLib   testStruct;
                        testStruct.tmpIntA   =   2;
                        testStruct.tmpIntB   =   3;
                        testStruct.tmpStr   =   "Hello   World! ";

      string   strPath= "D:\\MyFormLib.dll ";
      Assembly   a   =   Assembly.LoadFrom(strPath);
            object   obj   =   a.CreateInstance( "MyFormLib.Form1 ");
      Form   frm=obj   as   Form;
                        frm.ShowDialog();
我怎么才能把testStruct这个结构的引用传递给frm?frm的构造函数需要一个testStruct结构的引用参数。dll中包含一个窗体,我需要窗体在显示的时候显示出testStruct结构中的数据。麻烦各位高手给小弟一个明确的答案,小弟才看是看C#,很多问题不明白,谢谢各位了


------解决方案--------------------
up 再说
------解决方案--------------------
up 再说
------解决方案--------------------
public Object CreateInstance (
string typeName,
bool ignoreCase,
BindingFlags bindingAttr,
Binder binder,
Object[] args,
CultureInfo culture,
Object[] activationAttributes
)

------解决方案--------------------
up
------解决方案--------------------
public Object CreateInstance (
string typeName,
bool ignoreCase,
BindingFlags bindingAttr,
Binder binder,
Object[] args,
CultureInfo culture,
Object[] activationAttributes
)

这不可以传参数吗?
------解决方案--------------------
传地址好象是ref :void abc(ref int a,ref int b)