public void UpdatePropertiesDic(string name, string value) { if (name != null) { if (!PropertiesDic.ContainsKey(name)) { PropertiesDic.Add(name, ""); } foreach (KeyValuePair <string, string> kvp in PropertiesDic) { if (kvp.Key == name) { PropertiesDic.Remove(name); PropertiesDic.Add(name, value); break; } } } }
/// <summary> /// Remove a property from the Dictionary /// </summary> /// <example> /// grassland: all | yes | no /// grassland is name /// value is (all | yes | no) /// </example> /// <param name="name">Name of the property</param> /// <param name="value">Value of the property</param> public void RemoveFromPropertiesDic(string name, string value, SearchCriteria sc) { if (name != null) { if (sc.GetProperty(name) != null) { string datasourceKey = sc.GetProperty(name).DataSourceKey; if (PropertiesDic.ContainsKey(datasourceKey)) { foreach (KeyValuePair <string, string> kvp in PropertiesDic) { if (kvp.Value == value && kvp.Key == datasourceKey) { PropertiesDic.Remove(datasourceKey); break; } } } } } }