Ad

Ambiguous Class Members In Vb.net

- 1 answer

I am trying to use a class from a C# assembly in vb.net. The class has ambiguous members because vb.net is case insensitive. The class is something like this:

public class Foo {

  public enum FORMAT {ONE, TWO, THREE};

  public FORMAT Format {
    get {...}
    set {...}
   }
}

I try to access the enum: Foo.FORMAT.ONE

This is not possible because there is also a property named 'format'.

I can not change the C# assembly. How can I get around this and reference the enum from vb.net?

Ad

Answer

I don't think you can get around this. Get in touch with the author of the C# component you are trying to use and convince them to fix their code.

Incidentally, this is the primary reason behind the CLSCompliant(true) attribute, which if you are writing APIs or other code that has a high probability of being used by other languages you should always set. It would have flagged this issue for the original author to be aware of and fix correctly.

Ad
source: stackoverflow.com
Ad