Class RouterConfig

Configures runtime behavior of Router instances.

Inheritance
object
RouterConfig
HttpListenerRouterConfig
Implements
IEquatable<RouterConfig>
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: NanoRoute
Assembly: NanoRoute.dll
Syntax
public record RouterConfig : IEquatable<RouterConfig>
Examples
builder.ConfigureRouting(config => config with
{
    MatchingPrecedence = MatchingPrecedence.ParameterizedFirst,
    ParametersCapacity = 8
});

Constructors

RouterConfig()

Declaration
public RouterConfig()

Properties

MatchingPrecedence

Gets or sets how NanoRoute prioritizes literal and parameterized child segments at the same depth.

Declaration
public MatchingPrecedence MatchingPrecedence { get; init; }
Property Value
Type Description
MatchingPrecedence
Examples
builder.ConfigureRouting(config => config with { MatchingPrecedence = MatchingPrecedence.ParameterizedFirst });
Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown when the assigned value is not a defined MatchingPrecedence value.

ParametersCapacity

Gets or sets the initial capacity of the request parameter dictionary.

Declaration
public int ParametersCapacity { get; init; }
Property Value
Type Description
int
Remarks

Increase this value when typical requests add many route, query, or handler-shared values to Parameters and you want to reduce dictionary resizing.

Examples
builder.ConfigureRouting(config => config with { ParametersCapacity = 16 });
Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown when the assigned value is negative.

Implements

IEquatable<T>
In this article
Back to top Generated by DocFX