简体   繁体   English

使用界面时出现vb.net错误

[英]vb.net error using interface

I am getting this error 我收到了这个错误

"Error 19 Class 'LegacyRouteHandler' must implement 'Function GetHttpHandler(requestContext As RequestContext) As IHttpHandler' for interface 'System.Web.Routing.IRouteHandler'." “错误19类'LegacyRouteHandler'必须实现'Function GetHttpHandler(requestContext As RequestContext)作为IHttpHandler'用于接口'System.Web.Routing.IRouteHandler'。”

from this code: 从这段代码:

Public Class LegacyRouteHandler
    Implements IRouteHandler
    Public Function GetHttpHandler(requestContext As RequestContext) As IHttpHandler
        Return New LegacyHandler(requestContext)
    End Function
End Class

I am clearly implementing GetHttpHandler , any ideas why I am getting this error? 我正在清楚地实现GetHttpHandler ,任何想法我为什么会收到此错误?

You need to add an Implements clause after the function prototype. 您需要在函数原型之后添加一个Implements子句。

...) As IHttpHandler Implements IRouteHandler.GetHttpHandler
'                    ^

VB.NET doesn't automatically wire up functions to their interface definitions like C# does. VB.NET不会自动将函数连接到它们的接口定义,如C#。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM