Esempio n. 1
0
 public string this[ArgumentDescription argDesc] {
     get {
         if (!ArgDescMap.TryGetValue(argDesc, out string val))
         {
             return(ConfigurationManager.AppSettings[argDesc.Name]);
         }
         return(val);
     }
 }
Esempio n. 2
0
        public T GetAsType <T>(ArgumentDescription argDesc)
        {
            string value = this[argDesc];

            try {
                var converter = TypeDescriptor.GetConverter(typeof(T));
                return((T)(converter.ConvertFromInvariantString(value)));
            }
            catch (NotSupportedException) {
                return(default);