예제 #1
0
 public T Get <T>(string name)
 {
     if (_settingsTable.ContainsKey(name))
     {
         SettingsEntry <T> entry = (SettingsEntry <T>)_settingsTable[name];
         return(entry.Value);
     }
     else
     {
         return(default(T));
     }
 }
예제 #2
0
        public bool TryGet <T>(string name, out T value)
        {
            value = default(T);

            if (_settingsTable.ContainsKey(name))
            {
                SettingsEntry <T> entry = (SettingsEntry <T>)_settingsTable[name];
                value = entry.Value;
                return(true);
            }

            return(false);
        }
예제 #3
0
 public void Set <T>(string name, T value)
 {
     if (_settingsTable.ContainsKey(name))
     {
         SettingsEntry <T> entry = (SettingsEntry <T>)_settingsTable[name];
         entry.Value = value;
     }
     else
     {
         SettingsEntry <T> entry = new SettingsEntry <T>(default(T));
         entry.Value = value;
         _settingsTable.Add(name, entry);
         entry.OnSettingChanged += new EventHandler(OnSettingChanged);
     }
 }