RegexRouteConstraint.Match 方法

定义

确定 URL 参数是否包含此约束的有效值。

public:
 virtual bool Match(Microsoft::AspNetCore::Http::HttpContext ^ httpContext, Microsoft::AspNetCore::Routing::IRouter ^ route, System::String ^ routeKey, Microsoft::AspNetCore::Routing::RouteValueDictionary ^ values, Microsoft::AspNetCore::Routing::RouteDirection routeDirection);
public bool Match (Microsoft.AspNetCore.Http.HttpContext httpContext, Microsoft.AspNetCore.Routing.IRouter route, string routeKey, Microsoft.AspNetCore.Routing.RouteValueDictionary values, Microsoft.AspNetCore.Routing.RouteDirection routeDirection);
public bool Match (Microsoft.AspNetCore.Http.HttpContext? httpContext, Microsoft.AspNetCore.Routing.IRouter? route, string routeKey, Microsoft.AspNetCore.Routing.RouteValueDictionary values, Microsoft.AspNetCore.Routing.RouteDirection routeDirection);
abstract member Match : Microsoft.AspNetCore.Http.HttpContext * Microsoft.AspNetCore.Routing.IRouter * string * Microsoft.AspNetCore.Routing.RouteValueDictionary * Microsoft.AspNetCore.Routing.RouteDirection -> bool
override this.Match : Microsoft.AspNetCore.Http.HttpContext * Microsoft.AspNetCore.Routing.IRouter * string * Microsoft.AspNetCore.Routing.RouteValueDictionary * Microsoft.AspNetCore.Routing.RouteDirection -> bool
Public Function Match (httpContext As HttpContext, route As IRouter, routeKey As String, values As RouteValueDictionary, routeDirection As RouteDirection) As Boolean

参数

httpContext
HttpContext

一个对象,该对象封装有关 HTTP 请求的信息。

route
IRouter

此约束所属的路由器。

routeKey
String

要检查的参数的名称。

values
RouteValueDictionary

包含 URL 参数的字典。

routeDirection
RouteDirection

一个对象,指示在处理传入请求或生成 URL 时,是否正在执行约束检查。

返回

如果 URL 参数包含有效值,则为 true;否则为 false

实现

适用于