We have a C# class, which includes two functions, whose parameters differ only by the parameter modifier:
bool DoSomething(Object obj){};
bool DoSomething(ref Object obj){};
Now we need to call this method (any of them, actually) from VB.NET. The problem is that the VB.NET compiler can't decide, which method to use.
The question is: is there a way to tell the compiler that we want the first variant (or the second one, it doesn't matter for the caller)?
Writing the call as DoSomething((myObj))
(i.e. adding parentheses) in VB.NET doesn't help.
You could create a separate library written in C# that provides helper methods with distinct names to enable you to call the ambiguously defined
DoSomething
methods. You shouldn't have to do that, and people might wonder why you did, so you could fill it with scathing comments explaining why it was necessary.Or you could use reflection, something roughly like this: