MaxLengthRouteConstraint Class¶
Constrains a route parameter to be a string with a maximum length.
- Namespace
Microsoft.AspNetCore.Routing.Constraints
- Assemblies
- Microsoft.AspNetCore.Routing
Syntax¶
public class MaxLengthRouteConstraint : IRouteConstraint
-
class
Microsoft.AspNetCore.Routing.Constraints.
MaxLengthRouteConstraint
Constructors¶
-
MaxLengthRouteConstraint
(System.Int32)¶ Initializes a new instance of the
Microsoft.AspNetCore.Routing.Constraints.MaxLengthRouteConstraint
class.Arguments: maxLength (System.Int32) – The maximum length allowed for the route parameter. public MaxLengthRouteConstraint(int maxLength)
-
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.MaxLengthRouteConstraint.
MaxLength
¶ Gets the maximum length allowed for the route parameter.
Return type: System.Int32 public int MaxLength { get; }
-