The items are compared in one of two ways. If T implements IComparable<T> /// then the Equals method of that interface will be used to compare items, otherwise the Equals /// method from Object will be used. Alternatively, an instance of IComparer<T> can be passed /// to the constructor to use to compare items.
///Bag is implemented as a hash table. Inserting, deleting, and looking up an /// an element all are done in approximately constant time, regardless of the number of items in the bag.
///When multiple equal items are stored in the bag, they are stored as a representative item and a count. /// If equal items can be distinguished, this may be noticable. For example, if a case-insensitive /// comparer is used with a Bag<string>, and both "hello", and "HELLO" are added to the bag, then the /// bag will appear to contain two copies of "hello" (the representative item).
///Typically, this method is not called directly. Instead the "foreach" statement is used /// to enumerate the items, which uses this method implicitly.
///If an item is added to or deleted from the bag while it is being enumerated, then /// the enumeration will end with an InvalidOperationException.
///Enumeration all the items in the bag takes time O(N), where N is the number /// of items in the bag.
///