Reputation: 7248
I am working on a website in .NET 4, and it is giving me the following error:
'Trim' is ambiguous, imported from the namespaces or types 'MyLib.WEB.TextboxEx, Microsoft.VisualBasic.Strings'.
Problem is, which is confusing me, is that these functions have completely different signatures, so I have no idea why they would conflict.
The System function is defined as:
Public Function Trim(str As String) As String
While the MyLib one is defined as:
<Extension> Public Function Trim(
target As System.Web.UI.WebControls.TextBox
) As System.Web.UI.WebControls.TextBox
Given that they have wholly different signatures apart from the name, how can they possibly be ambiguous?
Upvotes: 2
Views: 1662
Reputation: 23070
Because overloading only works within the same class, it cannot tell if you're passing the wrong parameters to the method you meant to call. Best to tweak the using statements or fully qualify your call.
Upvotes: 2