Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用vb.net接口时出错_.net_Asp.net Mvc_Vb.net_Interface - Fatal编程技术网

使用vb.net接口时出错

使用vb.net接口时出错,.net,asp.net-mvc,vb.net,interface,.net,Asp.net Mvc,Vb.net,Interface,我得到了这个错误 “错误19类'LegacyRouteHandler'必须实现'函数 GetHttpHandler(requestContext作为requestContext)作为 接口'System.Web.Routing.iroutHandler' 根据该代码: Public Class LegacyRouteHandler Implements IRouteHandler Public Function GetHttpHandler(requestContext As R

我得到了这个错误

“错误19类'LegacyRouteHandler'必须实现'函数 GetHttpHandler(requestContext作为requestContext)作为 接口'System.Web.Routing.iroutHandler'

根据该代码:

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

很明显,我正在实现
GetHttpHandler
,您知道我为什么会出现此错误吗?

您需要在函数原型之后添加一个
Implements
子句

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

VB.NET不会像C#那样自动将函数连接到它们的接口定义。

这太差劲了,我仍然习惯于VB.NET中的这些小差异-谢谢