Exemplo n.º 1
0
 private static T[] GetArrayValue <T>(RegistryKey configuration, string name, T[] defaultValue, ConstantProvider.TryParse <T> tryParse)
 {
     string[] array = configuration.GetValue(name) as string[];
     T[]      array2;
     if (array == null || array.Length == 0)
     {
         array2 = defaultValue;
     }
     else
     {
         array2 = new T[array.Length];
         for (int i = 0; i < array.Length; i++)
         {
             if (!tryParse(array[i], out array2[i]))
             {
                 array2 = defaultValue;
                 break;
             }
         }
     }
     return(array2);
 }
Exemplo n.º 2
0
        private static T GetValue <T>(RegistryKey configuration, string name, T defaultValue, ConstantProvider.TryParse <T> tryParse)
        {
            string text = configuration.GetValue(name) as string;
            T      result;

            if (text == null || !tryParse(text, out result))
            {
                result = defaultValue;
            }
            return(result);
        }