Overload resolution failed because no Public 'Add' is most specific for these arguments
2007-08-01 08:20
786 查看
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
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.
Option Strict Statement
CType Function
Considerations in Overloading Procedures
Overload Resolution
Overloaded Properties and Methods
'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
Review all the overloads for the method and determine which one you want to call.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
OverloadsOption Strict Statement
CType Function
Concepts
Procedure OverloadingConsiderations in Overloading Procedures
Overload Resolution
Overloaded Properties and Methods
相关文章推荐
- 使用Struts2动态方法调用时(DMI)出现There is no Action mapped for namespace [/user] and action name [user!add] 问题
- here is no Action mapped for namespace [/user] and action name [user!add] associated with context pa
- Login failed for user 'sa' because the account is currently locked out. The system administrator can unlock it.
- There is no Action mapped for namespace [/] and action name [user!add] associated with context path
- W: There is no public key available for the following key IDs: 3B4FE6ACC0B21F32
- Can't install '*' from pristine store, because no checksum is recorded for this file
- 每当使用struts2动态方法调用时,总是出现错误:There is no Action mapped for namespace [/user] and action name [user!add]
- OSCache的源码编译Cache.java 文件报add(Class, T) in the type EventListenerList is not applicable for the arguments 错误的解决
- backup log is terminating abnormally because for write on file failed: 112(error not found)
- The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the ser
- CS1501: No overload for method 'CreateProduct' takes '9' arguments 解决
- Failed routing because there is no subscribing orchestration or send port
- struts2报错:There is no Action mapped for namespace [/] and action name [userAction!add]
- Can't install '*' from pristine store, because no checksum is recorded for this file
- There is no Action mapped for namespace [/user] and action name [user!add] associated with context p
- CFURLSetResourcePropertyForKey failed because it was passed this URL which has no scheme
- Can't install '*' from pristine store, because no checksum is recorded for this file (SVN报错)
- Spring Boot中使用Feign调用时Hystrix提示异常:"could not be queued for execution and no fallback available."以及"Rejected command because thread-pool queueSize is at rejection threshold"
- Can't allocate space for object 'syslogs' in database 'ge' because 'logsegment' segment is full/has no free extents. If you ran
- The method add(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (i