我有以下两类:如何在DLL中导出事件?
public class DLLClass {
public delegate void dllDelegate(Object sender, EventArgs e);
public event dllDelegate dllEvent;
.....
}
class AppClass {
DLLClass dll;
public AppClass() {
dll.dllEvent += new DLLClass.dllDelegate(dllEventHandler);
}
public void dllEventHandler(Object sender, EventArgs e){
}
}
每一个都是相同的解决方案的一部分,但指的是不同的项目。
问题是编译器说在DLLClass
中没有dllEvent
成员。
编辑: 错误:
error CS1061: 'AppNamespace.DLLClass ' does not contain a definition for 'dllEvent ' and no extension method 'dllEvent ' accepting a first argument of type 'AppNamespace.DLLClass ' could be found (are you missing a using directive or an assembly reference?)
error CS0426: The type name 'dllDelegate' does not exist in the type 'AppNamespace.DLLClass.ParametersPanel'
而且当我尝试看看DLLClass
的定义从AppClass
代码,MSVS显示我从元数据类的定义与它没有任何代表。
编译器是否找到“DLLClass”?你说它只是抱怨'dllEven'。 – 2013-03-19 13:01:37
@ MD.Unicorn,是的,它发现。 – Alex 2013-03-19 13:02:27
什么是确切的编译器错误? – alex 2013-03-19 13:02:28