Delen via


Extension method '<methodname>' defined in '<modulename>' is not generic (or has no free type parameters) and so cannot have type arguments

A type argument has been specified in a call to an extension method that either has no generic parameters or has no generic parameters for which a type is not already specified. For example, the following code causes this error.

' The extension method is not generic.
<Extension()> _
Sub Example(ByVal str As String)
    ' Body of the Sub.
End Sub
Dim str = "hi"
'' The call to Example specifies a type argument.
'' Not valid.
'str.Example(Of String)()

Error ID: BC36907

To correct this error

  • Add a type parameter to the extension method definition.

  • Remove the extra type argument from the procedure call.

See Also

Concepts

Extension Methods (Visual Basic)

Generic Procedures in Visual Basic