示例#1
0
 /// <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();
         }
 }
示例#2
0
 /// <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);
         }
 }
示例#3
0
 /// <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);
             }
         }
 }