Beispiel #1
0
        // TODO: Consider putting check for null to derived classes.
        public virtual void Add(T item)
        {
            EqtAssert.ParameterNotNull(item, "item");

            if (!this.container.Contains(item))
            {
                this.container.Add(item, null);    // Do not want to xml-persist the value.
            }
        }
Beispiel #2
0
        /// <summary>
        /// Removes specified item from collection.
        /// </summary>
        /// <param name="item">The item to remove.</param>
        /// <returns>True if collection contained the item, otherwise false.</returns>
        public virtual bool Remove(T item)
        {
            EqtAssert.ParameterNotNull(item, "item");   // This is to be consistent with Add...

            if (this.container.Contains(item))
            {
                this.container.Remove(item);
                return(true);
            }
            return(false);
        }
Beispiel #3
0
 /// <summary>
 /// Copy constructor. Shallow copy.
 /// </summary>
 /// <param name="other">The object to copy items from.</param>
 protected EqtBaseCollection(EqtBaseCollection <T> other)
 {
     EqtAssert.ParameterNotNull(other, "other");
     this.container = new Hashtable(other.container);
 }
Beispiel #4
0
 /// <summary>
 /// Copies all items to the array.
 /// As FxCop recommends, this is an explicit implementation and derived classes need to define strongly typed CopyTo.
 /// </summary>
 public virtual void CopyTo(T[] array, int index)
 {
     EqtAssert.ParameterNotNull(array, "array");
     this.container.Keys.CopyTo(array, index);
 }