RangeRouteConstraint Class

Constraints a route parameter to be an integer within a given range of values.

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

Syntax

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

Constructors

RangeRouteConstraint(System.Int64, System.Int64)

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

Arguments:
  • min (System.Int64) – The minimum value.
  • max (System.Int64) – The maximum value.
public RangeRouteConstraint(long min, 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.RangeRouteConstraint.Max

Gets the maximum allowed value of the route parameter.

Return type:System.Int64
public long Max { get; }
Microsoft.AspNetCore.Routing.Constraints.RangeRouteConstraint.Min

Gets the minimum allowed value of the route parameter.

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