更新:2007 年 11 月
扩展方法的签名与您试图使用的委托的签名不匹配。Delegate 语句定义委托类的参数类型和返回类型。任何具有匹配参数、类型和返回类型的过程均可用来创建此委托类型的实例。在下面的示例中报告此错误,因为扩展方法 Example 的签名与委托 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
**错误 ID:**BC36580
更正此错误
验证委托与扩展方法是否具有相同数量的参数。
验证委托和扩展方法中的参数顺序是否相同。
将每个委托参数的数据类型与相应的扩展方法参数的数据类型进行比较,以确保它们兼容。