Пример #1
0
        public static T Get <T>(this IDictionary <string, object> d, string key)
        {
            object obj = d[key];

            if (obj == null)
            {
                return(default(T));
            }
            return(TypeParsers.ConvertTo <T>(obj));
        }
Пример #2
0
        public static T Get <T>(this IDictionary d, string section, string key)
        {
            object obj = d.Get(section, key);

            if (obj == null)
            {
                return(default(T));
            }
            return(TypeParsers.ConvertTo <T>(obj));
        }
Пример #3
0
 public static T Get <T>(this IDictionary <string, string> items, string Key)
 {
     if (items == null)
     {
         return(default(T));
     }
     if (!items.ContainsKey(Key))
     {
         return(default(T));
     }
     return(TypeParsers.ConvertTo <T>(items[Key]));
 }
Пример #4
0
        public static T GetOrDefault <T>(NameValueCollection collection, string key, T defaultValue)
        {
            if (collection == null)
            {
                return(defaultValue);
            }
            string text = collection[key];

            if (string.IsNullOrEmpty(text))
            {
                return(defaultValue);
            }
            return(TypeParsers.ConvertTo <T>(text));
        }
Пример #5
0
        public static string ToChinese(string x)
        {
            double x2 = TypeParsers.ConvertTo <double>(x);

            return(RMB.ToChinese(x2));
        }