/// <summary> /// Only add items from the other set to the collection if the key doesn't already exist. /// (Previous sets are more specific than subsequent sets) /// </summary> /// <param name="otherSet">less-specific set of name/value replacement token pairs</param> public void ReplacementTokensApplyDefaults(IDictionary <string, string> otherSet) { if (otherSet != null) { foreach (var item in otherSet) { if (!ReplacementTokens.ContainsKey(item.Key)) { // add new value; ignore keys that already exist ReplacementTokens.Add(item); } } } }
/// <summary> /// Always add items from the other set, replacing any pre-existing items in the collection. /// (Subsequent sets are more specific than previous sets) /// </summary> /// <param name="otherSet">more-specific set of name/value replacement token pairs</param> public void ReplacementTokensApplyOverrides(IDictionary <string, string> otherSet) { if (otherSet != null) { foreach (var item in otherSet) { if (!ReplacementTokens.ContainsKey(item.Key)) { // add new value ReplacementTokens.Add(item); } else { // replace existing value ReplacementTokens[item.Key] = item.Value; } } } }