I have a C# .NET assembly that implements a function that returns an int and an overload that returns an Int32.
public int GetAudioInputLevel()
public Int32 GetAudioInputlevel()
If I use the assembly from a C# .NET application and call that function, it works fine.
If I call my assembly’s function from a vb.NET application, I get the following error :
Error [myfunctionname] is ambiguous because multiple kinds of members
with this name exist in class ‘[myassemblysclass] …
Can someone suggest a workaround, to use that function in vb.net without having to change the signature of that function in my c# .net assembly ?
Thanks
VB.NET is not case-sensitive, so these are the same methods, as far as the language is concerned. You’ll need to either change the name of one of them or add a parameter, which would change the method signature enough so that it’s different. However, don’t add a parameter just to add one.
It is confusing, though, because int and Int32 are the same thing even though they don’t look it. A
longis also an alias for Int64,floatfor Single, the list for C# can be found here.It’s also worth noting that even if you had a method returning something other than an int, say, a long, two methods signatures can’t differ only by return value.