문제

In my c# project, I'm referncing an old com server written in vb6. When tyring to access a property "ModuleLoaded" (meaning "IsModuleLoaded"), I get an ambiguity warning because the server also defines an event with the same name. My code looks like this:

if (fwb.Controller.ModuleLoaded == false) {
  fwb.Controller.LoadModule();
}

Visual Studio tells me this:

Error: Ambiguity between "MCS._clsController.ModuleLoaded" and
"MCS.__clsController_Event.ModuleLoaded".

How can I resolve the ambiguity without changing code in the com server itself?

Thanks for your help.

도움이 되었습니까?

해결책

You should be able to cast to the generated containing interface;

if (((MCS._clsController)fwb.Controller).ModuleLoaded == false) {
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top