private static JsonDictionary <K, V> DictionaryUnion <K, V>( JsonDictionary <K, V> thisDict, JsonDictionary <K, V> thatDict, Func <V, V, object> valueUnionizer = null) where K : ICloneable where V : ICloneable { if (thatDict == null) { return(thisDict); } if (thisDict == null) { return((JsonDictionary <K, V>)thatDict.Clone()); } foreach (KeyValuePair <K, V> item in thatDict) { if (!thisDict.ContainsKey(item.Key)) { thisDict.Add(item.Key, item.Value); continue; } if (valueUnionizer != null) { thisDict[item.Key] = (V)valueUnionizer(thisDict[item.Key], item.Value); } } return(thisDict); }