Hi,

is there any possibility to write an operator member function for a ref class in C++/CLI which can be called directly from Visual Basic using the common Visual Basic syntax? Of course this can be done with an additional (VB-)wrapper class - but without?

In detail:
Assume we have a ref class written in C++/CLI, let's call it MyClass.
In MyClass we have a member function: static bool operator==(const MyClass^ left, const MyClass^ right).
Now, we make a dll of this project and import it into a VB-programm. Then we can call this operator function from within VB using the following syntax: MyClass.op_Equality(Left, Right) where Left and Right are objects of type MyClass.
But this it not VB-style syntax.

Of course we can declare a wrapper class, e.g. VBClass with an operator function:
Public Shared Shadows Operator =(ByVal Left As VBClass, ByVal Right As VBClass) As Boolean
in which we call .op_Equality(). Then we can use this wrapper class and call the operator function in VB-syntax style (e.g. If Obj1 == Obj2 Then ...).

BUT: I don't want to have an additional wrapper class (in my project I already have 3 nested wrapper classes and I don't want to have a fourth one!).

THEREFORE: Is there any possibility to write an operator member function within C++/CLI in such a way it will be understood from within VB (with it's syntax)?


Many thanks in advance,

Physicus.