Set - Description


The generic class Set has a single type parameter, T - the data type of the set. The generic class Set exists in the namespace Calculus (in assembly Calculus.dll).

When creating a set Set<T>, the key class T is expected to be comparable. There are two ways in which the comparer for class T can be specified:

  1. the class T may derive from IComparable of T or
  2. the constructor Set - Comparer may be used to manually specify the comparer.

The declaration of the set class (in C#) is shown below.

[Serializable]
public class Set<T> : ISet<T>,
                      IComparable<Set<T>>,
                      IEquatable<Set<T>>

When foreach is applied to a set, the entries are presented in key order.