Last post Aug 05, 2011 06:10 AM by Menno van den Heuvel
Aug 04, 2011 07:38 AM|Fardin S|LINK
I have an assembly created in C# which has two methods with the same name (but in different cases)
private void abc()
private void ABC()
The above assembly created is referenced in my VB.Net language project.
Now VB.net being case in sensitive, how will my application would compile and refer to the appropriate method.
hope the question is clear?
Aug 04, 2011 11:06 AM|Menno van den Heuvel|LINK
The msdn page on this problem is quite clear:
http://msdn.microsoft.com/en-us/library/ms235408(v=vs.90).aspx . You can't do that.
I'm sure I could come up with a pragmatic solution to the problem, but I get the feeling this is more of a hypothetical question. If not, let me know.
Aug 04, 2011 02:54 PM|atconway|LINK
Without being too obvious here, is there any major obstacle in overloading the methods or changing one of the names to be different, and then making a small modification to the C# application referring to the old method name?
If this will not work, there are a few ways around this. If the code containing this is in C# and added as a reference, the application should still compile. You could consider adding a 'proxy' method(s) within the C# code that would only be called by the
VB.NET application. All these new methods would do is call the different 'abc' or 'ABC' methods, but be different to allow the VB.NET code to work. Example:
public void abc1
public void abc2
Aug 05, 2011 05:04 AM|Fardin S|LINK
Thanks for the reply!
But i am not asking for a work around, infact I am asking for the solution to such problems.
Aug 05, 2011 06:10 AM|Menno van den Heuvel|LINK
The solutions to this problem are, in the following order:
public static class CSharpClass
public static string TEST()
return "UPPER CASE";
public static string test()
return "lower case";
Dim type As Type = GetType(CSharpClass)
Dim method As MethodInfo = type.GetMethod("TEST")
If Not method Is Nothing Then
Dim returnValue As String = method.Invoke(Nothing, Nothing)
'returnValue will be "UPPER CASE" here