public void Add <T>(SettingNameBase name, T value)
 {
     if (!settings.ContainsKey(name.ToString()))
     {
         settings.Add(name.ToString(), value);
     }
     else
     {
         throw new ArgumentException(string.Format("A setting with the key '{0}' already exists.", name.ToString().Replace("+", ".")));
     }
 }
        public bool TryGetValue <T>(SettingNameBase name, out T value)
        {
            bool dictContainsKey = false;

            if (dictContainsKey = settings.ContainsKey(name.ToString()))
            {
                try
                {
                    value = (T)Convert.ChangeType(settings[name.ToString()], typeof(T));
                }
                catch (InvalidCastException ex)
                {
                    string errMsg = string.Format("Invalid cast of value '{0}' to type of {1} in Setting.Value<T>() method.",
                                                  settings[name.ToString()], typeof(T).FullName);
                    throw new InvalidCastException(errMsg, ex);
                }
            }
            else
            {
                value = default(T);
            }
            return(dictContainsKey);
        }