Extension method '<methodName>' defined in '<typeName>' does not have the same signature as delegate '<delegateName>'

There is a mismatch between the signatures of the extension method and the delegate that you are attempting to use. The Delegate statement defines the parameter types and return types of a delegate class. Any procedure with matching parameters, types, and return types can be used to create an instance of this delegate type. This error is reported in the following example because the signature of extension method Example is not compatible with the signature of delegate Del.

' Definition of the delegate, with two parameters.
Delegate Sub Del(ByVal m As Integer, ByVal s As String)
' Definition of the extension method, with one parameter.
<Extension()> _
Sub Example(ByVal s As String)
    ' Body of the Sub.
End Sub
'' This assignment causes the error.
' Dim exampleDel As Del = AddressOf Example

Error ID: BC36580

To correct this error

  • Verify that the delegate and the extension method have the same number of parameters.

  • Verify that the order of the parameters is the same in the delegate and the extension method.

  • Compare the data type of each delegate parameter to the data type of the corresponding extension method parameter to make sure they are compatible.

See Also

Concepts

Extension Methods (Visual Basic)

Relaxed Delegate Conversion

Reference

Delegate Statement