共用方式為


StringRouteConstraint.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

實作

適用於