Overload resolution failed because no Public 'Add' is most specific for these arguments

ex.Message = "Overload resolution failed because no Public 'Add' is most specific for these arguments:
    'Public Sub Add(item As System.Web.UI.WebControls.ListItem)':
        Not most specific.
    'Public Sub Add(item As String)':
        Not most specific."

what do you meaning?
why?

Microsoft MSDN Description

Visual Basic Reference: Error Messages 
Overload resolution failed because no accessible '<method>' is most specific for these arguments:<error> 

You have made a call to an overloaded method, but the compiler has found two or more overloads with parameter lists to which your argument list can be converted, and it cannot select among them.

The compiler attempts to match the data types in the calling argument list and the overload parameter list as closely as possible. It requires a widening conversion from every one of your arguments to its corresponding parameter, whether the type checking switch (Option Strict Statement) is On or Off.

If the compiler finds more than one overload satisfying the widening requirement, it then looks for the overload that is most specific for the argument data types, that is, that calls for the least amount of widening. It generates this error message when one overload is more specific for one argument's data type while another overload is more specific for another argument's data type. For more information and an example, see Overload Resolution.

Error ID: BC30521

To correct this error

  1. Review all the overloads for the method and determine which one you want to call.

  2. In your calling statement, make the data types of the arguments match the data types of the parameters defined for the desired overload. You might have to use the CType Function to convert one or more data types to the defined types.

See Also

Reference

Overloads
Option Strict Statement
CType Function

Concepts

Procedure Overloading
Considerations in Overloading Procedures
Overload Resolution
Overloaded Properties and Methods

你可能感兴趣的:(arguments)