none
RouteValueDictionary initialization confusing RRS feed

  • Question

  • Hi  I cannot understand  the way  RouteValueDictionary class is initialized: for example does the constructor take arrays of string?


    public static void RegisterRoutes(RouteCollection routes)
    {
        Route reportRoute = new Route("{locale}/{year}", new ReportRouteHandler());
        reportRoute.Defaults = new RouteValueDictionary { { "locale", "en-US" }, { "year", DateTime.Now.Year.ToString() } };
        reportRoute.Constraints = new RouteValueDictionary { { "locale", "[a-z]{2}-[a-z]{2}" }, { "year", @"\d{4}" } };
        reportRoute.DataTokens = new RouteValueDictionary { { "format", "short" } };
        routes.Add(reportRoute);
    }

    Friday, October 11, 2019 8:35 PM

Answers