I am using a C# DLL from an VB project, so far I hadn't problems, but after updating DLL version I have some compilation errors when calling functions, I'm not sure if the problem comes from optional parameters or output parameters.
In short, my problem is the opposite to this one.
This is an example of function definition in DLL (if I fix this one it happens in other function calls, it's a BIG dll):
public static bool RequestCode(string countryCode, string phoneNumber, out string password, string method = "sms", string id = null, string language = null, string locale = null, string mcc = "204", string salt = "")
public static bool RequestCode(string countryCode, string phoneNumber, out string password, out string response, string method = "sms", string id = null, string language = null, string locale = null, string mcc = "204", string salt = "")
public static bool RequestCode(string countryCode, string phoneNumber, out string password, out string request, out string response, string method = "sms", string id = null, string language = null, string locale = null, string mcc = "204", string salt = "")
This is my call from VB (all of them throw error):
result = ThatLibrary.ThatClass.RequestCode(country, telephone, pass, cc, method)
Or
result = ThatLibrary.ThatClass.RequestCode(country, telephone, pass, method)
Or
result = ThatLibrary.ThatClass.RequestCode(country, telephone, pass, method, Nothing, Nothing, Nothing, "204", "")
Or
result = ThatLibrary.ThatClass.RequestCode(countryCode:=pais, phoneNumber:=telefono, password:=password, method:=metodo, id:=Nothing, language:=Nothing, locale:=Nothing, mcc:="204", salt:="")
And this is error message:
Error 3 'RequestCode' is ambiguous because multiple kinds of members with this name exist in class 'ThatClass'.
After some days looking for a soluction I'm considering moving all my project to C# but this is a huge task so I hope there's a simple solution I missed...
You have to name all your parameters for this case to work in VB. Your last method call (naming all parameters) works with the following test:
C# dll:
VB project, referencing the C# dll: