MinLengthRouteConstraint Class

Constrains a route parameter to be a string with a minimum length.

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

Syntax

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

Constructors

MinLengthRouteConstraint(System.Int32)

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

Arguments:minLength (System.Int32) – The minimum length allowed for the route parameter.
public MinLengthRouteConstraint(int minLength)

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.MinLengthRouteConstraint.MinLength

Gets the minimum length allowed for the route parameter.

Return type:System.Int32
public int MinLength { get; }