Example #1
0
        public object GetValue(string name)
        {
            var result = valueProvider.GetValue(name);

            if (result != null)
            {
                return(result.RawValue);
            }
            return(null);
        }
Example #2
0
 public static bool TryGetValue(this System.Web.Mvc.IValueProvider valueProvider, string key, out ValueProviderResult result)
 {
     try
     {
         result = valueProvider.GetValue(key);
         return(true);
     }
     catch
     {
         result = null;
         return(false);
     }
 }
Example #3
0
            public IEnumerable <T> GetValues <T>(string key)
            {
                var value = _valueProvider.GetValue(key);

                if (value != null &&
                    value.RawValue.GetType() == typeof(T))
                {
                    return new[] { (T)value.RawValue }
                }
                ;

                return(Enumerable.Empty <T>());
            }
        }