translate code from C# to VB.NET

隐身守侯 提交于 2019-12-09 02:27:30

Remove the Key.

Public Shared Sub RegisterRoutes(routes As RouteCollection)
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}")

    Dim config = New HttpConfiguration() With { _
        .EnableTestClient = True _
    }
    routes.Add(New ServiceRoute("api/contacts", New HttpServiceHostFactory() With { _
        .Configuration = config _         <-----------Name of field or property being initialized in an object initializer must start with '.'. 
    }, GetType(ContactsApi)))

    ' Route name
    ' URL with parameters
    ' Parameter defaults
    routes.MapRoute("Default", "{controller}/{action}/{id}", New With { _
         .controller = "Home", _
         .action = "Index", _
         .id = UrlParameter.[Optional] _
    })
End Sub     
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!