Question

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.

Was it helpful?

Solution

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

if (((MCS._clsController)fwb.Controller).ModuleLoaded == false) {
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top