RouteData

 public class RouteData
    {
        private RouteValueDictionary _dataTokens;
        private IRouteHandler _routeHandler;
        private RouteValueDictionary _values;
        public RouteData()
        {
            this._values = new RouteValueDictionary();
            this._dataTokens = new RouteValueDictionary();
        }

        public RouteData(RouteBase route, IRouteHandler routeHandler)
        {
            this._values = new RouteValueDictionary();
            this._dataTokens = new RouteValueDictionary();
            this.Route = route;
            this.RouteHandler = routeHandler;
        }

        public string GetRequiredString(string valueName)
        {
            object obj2;
            if (this.Values.TryGetValue(valueName, out obj2))
            {
                string str = obj2 as string;
                if (!string.IsNullOrEmpty(str))
                {
                    return str;
                }
            }
            throw new InvalidOperationException(string.Format(CultureInfo.CurrentUICulture, System.Web.SR.GetString("RouteData_RequiredValue"), new object[] { valueName }));
        }

        public RouteValueDictionary DataTokens
        {
            [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
            get
            {
                return this._dataTokens;
            }
        }

        public RouteBase Route
        {
            get
            {
                return this.<Route>k__BackingField;
            }
            set
            {
                this.<Route>k__BackingField = value;
            }
        }

        public IRouteHandler RouteHandler
        {
            get
            {
                return this._routeHandler;
            }
            set
            {
                this._routeHandler = value;
            }
        }

        public RouteValueDictionary Values
        {
            get
            {
                return this._values;
            }
        }
    }
View Code

相关文章: