Data type(s) of the type parameter(s) cannot be inferred from these arguments
Data type(s) of the type parameter(s) cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.
This error occurs when overload resolution has failed. It occurs as a subordinate message that states why a particular overload candidate has been eliminated. The error message explains that the compiler cannot use type inference to find data types for the type parameters.
Note
When specifying arguments is not an option (for example, for query operators in query expressions), the error message appears without the second sentence.
The following code demonstrates the error.
Module Module1
Sub Main()
'' Not Valid.
'OverloadedGenericMethod("Hello", "World")
End Sub
Sub OverloadedGenericMethod(Of T)(ByVal x As String, ByVal y As _
InterfaceExample(Of T))
End Sub
Sub OverloadedGenericMethod(Of T, R)(ByVal x As T, ByVal y As _
InterfaceExample(Of R))
End Sub
End Module
Interface InterfaceExample(Of T)
End Interface
Error ID: BC36647 and BC36644
To correct this error
- You may be able to specify a data type for the type parameter or parameters instead of relying on type inference.
See Also
Concepts
Generic Procedures in Visual Basic