public void Add_Setting(string Key, string Value)
{
// Look for existing key that matches
// Ensure the list is defined
if (Settings == null) Settings = new List<StringKeyValuePair>();
// Ensure the dictionary was built
if (settingLookupDictionary == null) settingLookupDictionary = new Dictionary<string, StringKeyValuePair>(StringComparer.OrdinalIgnoreCase);
if (settingLookupDictionary.Count != Settings.Count)
{
foreach (StringKeyValuePair setting in Settings)
settingLookupDictionary[setting.Key] = setting;
}
// Does this key already exist?
if (settingLookupDictionary.ContainsKey(Key))
settingLookupDictionary[Key].Value = Value;
else
{
StringKeyValuePair newValue = new StringKeyValuePair(Key, Value);
Settings.Add(newValue);
settingLookupDictionary[Key] = newValue;
}
}