Unosquare
    Show / Hide Table of Contents

    Class RouteMatcher

    Matches URL paths against a route.

    Inheritance
    Object
    RouteMatcher
    Namespace: EmbedIO.Routing
    Syntax
    public sealed class RouteMatcher : IEquatable<RouteMatcher>

    Properties

    IsBaseRoute

    Gets a value indicating whether the Route property is a base route.

    Declaration
    public bool IsBaseRoute { get; }
    Property Value
    Type Description
    Boolean

    ParameterNames

    Gets the names of the route's parameters.

    Declaration
    public IReadOnlyList<string> ParameterNames { get; }
    Property Value
    Type Description
    IReadOnlyList<String>

    Route

    Gets the route this instance matches URL paths against.

    Declaration
    public string Route { get; }
    Property Value
    Type Description
    String

    Methods

    ClearCache()

    Clears RouteMatcher's internal instance cache.

    Declaration
    public static void ClearCache()
    See Also
    Parse(String, Boolean)
    TryParse(String, Boolean, out RouteMatcher)

    Equals(RouteMatcher)

    Indicates whether this instance is equal to another instance of RouteMatcher.

    Declaration
    public bool Equals(RouteMatcher other)
    Parameters
    Type Name Description
    RouteMatcher other

    A RouteMatcher to compare with this instance.

    Returns
    Type Description
    Boolean

    true if this instance is equal to other; otherwise, false.

    Equals(Object)

    Determines whether the specified Object is equal to this instance.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    The Object to compare with this instance.

    Returns
    Type Description
    Boolean

    true if obj is equal to this instance; otherwise, false.

    GetHashCode()

    Returns a hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

    Match(String)

    Matches the specified URL path against Route and extracts values for the route's parameters.

    Declaration
    public RouteMatch Match(string path)
    Parameters
    Type Name Description
    String path

    The URL path to match.

    Returns
    Type Description
    RouteMatch

    If the match is successful, a RouteMatch object; otherwise, null.

    Parse(String, Boolean)

    Constructs an instance of RouteMatcher by parsing the specified route.

    If the same route was previously parsed and the ClearCache() method has not been called since, this method obtains an instance from a static cache.

    Declaration
    public static RouteMatcher Parse(string route, bool isBaseRoute)
    Parameters
    Type Name Description
    String route

    The route to parse.

    Boolean isBaseRoute

    true if the route to parse is a base route; otherwise, false.

    Returns
    Type Description
    RouteMatcher

    A newly-constructed instance of RouteMatcher that will match URL paths against route.

    See Also
    TryParse(String, Boolean, out RouteMatcher)
    ClearCache()

    TryParse(String, Boolean, out RouteMatcher)

    Attempts to obtain an instance of RouteMatcher by parsing the specified route.

    If the same route was previously parsed and the ClearCache() method has not been called since, this method obtains an instance from a static cache.

    Declaration
    public static bool TryParse(string route, bool isBaseRoute, out RouteMatcher result)
    Parameters
    Type Name Description
    String route

    The route to parse.

    Boolean isBaseRoute

    true if the route to parse is a base route; otherwise, false.

    RouteMatcher result

    When this method returns true, a newly-constructed instance of RouteMatcher that will match URL paths against route; otherwise, null. This parameter is passed uninitialized.

    Returns
    Type Description
    Boolean

    true if parsing was successful; otherwise, false.

    See Also
    Parse(String, Boolean)
    ClearCache()

    Comments

    Back to top Copyright © 2017-2019 Unosquare