Rebel.Cms.Web.RouteDataExtensions.GetRequiredValue C# (CSharp) Method

GetRequiredValue() public static method

public static GetRequiredValue ( this routeData, string key ) : object
routeData this
key string
return object
        public static object GetRequiredValue(this RouteData routeData, string key)
        {
            if (routeData.Values.Any(x => x.Key == key))
            {
                return routeData.Values.Where(x => x.Key == key).First().Value;
            }
            throw new InvalidOperationException("The RouteData must contain an item named '" + key + "' with a non-null value");
        }