示例#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));
        }