Domanda

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.

È stato utile?

Soluzione

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

if (((MCS._clsController)fwb.Controller).ModuleLoaded == false) {
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top