The generic class Bag is a set with support for duplicate keys. The generic has a single type parameter, T - the data type of the bag. The generic class Bag exists in the namespace Calculus (in assembly Calculus.dll).
When creating a bag Bag<T>, the key class T is expected to be comparable. There are two ways in which the comparer for class T can be specified:
The declaration of the bag class (in C#) is shown below.
[Serializable] public class Bag<T> : ISet<T>, IEquatable<Bag<T>>
When foreach is applied to a bag, the entries are presented in key order.