private static void UpdateLocal(Dictionary <TKey, T> localDict, ItemAction <KeyValuePair <TKey, T> > x) { switch (x.ActionType) { case ActionType.Add: case ActionType.Update: foreach (KeyValuePair <TKey, T> item in x.Items) { localDict[item.Key] = item.Value; } break; case ActionType.Remove: foreach (KeyValuePair <TKey, T> item in x.Items) { localDict.Remove(item.Key); } break; case ActionType.Clear: localDict.Clear(); break; default: throw new ArgumentOutOfRangeException(); } }
private static void Update(List <T> local, ItemAction <T> x) { switch (x.ActionType) { case ActionType.Add: local.AddRange(x.Items); break; case ActionType.Update: //No update in this collection break; case ActionType.Remove: foreach (T item in x.Items) { local.Remove(item); } break; case ActionType.Clear: local.Clear(); break; default: throw new ArgumentOutOfRangeException(); } }