示例#1
0
        internal RouteTree GetBranch(string route)
        {
            RouteTree rt;

            return(Specific.TryGetValue(route, out rt)
                ? rt
                : (Parameter ?? General));
        }
示例#2
0
        internal RouteTree AddBranch(string route)
        {
            switch (route)
            {
            case "*":
                return(General ?? (General = new RouteTree(route, this)));

            case "^":
                return(Parameter ?? (Parameter = new RouteTree(route, this)));

            default:
                RouteTree nr;
                if (Specific.TryGetValue(route, out nr))
                {
                    return(nr);
                }
                nr = new RouteTree(route, this);
                Specific.Add(route, nr);
                return(nr);
            }
        }