/// <summary> /// Adds all objects-data pairs from a different storage in the current storage. /// </summary> public virtual void addAll(SplObjectStorage storage) { using (var e = storage.storage.GetFastEnumerator()) while (e.MoveNext()) { this.storage[e.CurrentKey] = e.CurrentValue.DeepCopy(); } }
/// <summary> /// Removes objects contained in another storage from the current storage. /// </summary> public virtual void removeAll(SplObjectStorage storage) { using (var e = storage.storage.GetFastEnumerator()) while (e.MoveNext()) { this.storage.RemoveKey(e.CurrentKey); } }
/// <summary> /// Removes all objects except for those contained in another storage from the current storage. /// </summary> public virtual void removeAllExcept(SplObjectStorage storage) { using (var e = this.storage.GetFastEnumerator()) while (e.MoveNext()) { if (!storage.storage.ContainsKey(e.CurrentKey)) { // NOTE: deleting element under the enumerator current entry, FastEnumerator survives this.storage.RemoveKey(e.CurrentKey); } } }