public void MergeWith(object obj) { // Same as CommonTable.MergeWith if (!MergeHelper.IsMergeable(this, obj)) { return; } CommonSortedTable <T> t = (CommonSortedTable <T>)obj; // Check values foreach (KeyValuePair <string, T> item in t.STable) { if (!_stable.ContainsKey(item.Key)) { Add(item.Value); } else { T value = _stable[item.Key]; if (typeof(IMergeable).IsAssignableFrom(value.GetType())) { ((IMergeable)value).MergeWith(item.Value); } } } }
public void MergeWith(object obj) { if (!MergeHelper.IsMergeable(this, obj)) { return; } CommonList <T> l = (CommonList <T>)obj; foreach (T item1 in l.List) { bool f = false; foreach (T item2 in _list) { if (item1.Equals(item2)) { if (typeof(IMergeable).IsAssignableFrom(item1.GetType())) { ((IMergeable)item1).MergeWith(item2); } f = true; break; } } if (!f) { Add(item1); } } }
public override void MergeWith(object obj) { if (!MergeHelper.IsMergeable(this, obj)) { return; } CommonMergeListItem item = (CommonMergeListItem)obj; for (int i = 0; i < MergeList.Length; i++) { if (MergeList[i] == null) { MergeList[i] = item.MergeList[i]; } else { MergeList[i].MergeWith(item.MergeList[i]); } } }