OptionalRouteConstraint.Match 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
判斷 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
。