MaxRouteConstraint Class

Constrains a route parameter to be an integer with a maximum value.

Namespace
Microsoft.AspNetCore.Routing.Constraints
Assemblies
  • Microsoft.AspNetCore.Routing

Syntax

public class MaxRouteConstraint : IRouteConstraint
class Microsoft.AspNetCore.Routing.Constraints.MaxRouteConstraint

Constructors

MaxRouteConstraint(System.Int64)

Initializes a new instance of the Microsoft.AspNetCore.Routing.Constraints.MaxRouteConstraint class.

Arguments:max (System.Int64) – The maximum value allowed for the route parameter.
public MaxRouteConstraint(long max)

Methods

Match(Microsoft.AspNetCore.Http.HttpContext, Microsoft.AspNetCore.Routing.IRouter, System.String, Microsoft.AspNetCore.Routing.RouteValueDictionary, Microsoft.AspNetCore.Routing.RouteDirection)
Return type:System.Boolean
public bool Match(HttpContext httpContext, IRouter route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection)

Properties

Microsoft.AspNetCore.Routing.Constraints.MaxRouteConstraint.Max

Gets the maximum allowed value of the route parameter.

Return type:System.Int64
public long Max { get; }