/// <summary> /// Returns true if both sets contain the same elements /// </summary> /// <param name="other">Other distinct set to compare</param> /// <returns>True if the sets are equal</returns> public bool SetEquals(IEnumerable <T> other) { var rhs = new Set <T>(other); if (rhs.Count() != Count) { return(false); } foreach (var item in rhs) { if (!Contains(item)) { return(false); } } return(true); }
public static int length <T>(Set <T> set) => set.Count();
public static int length <OrdT, T>(Set <OrdT, T> set) where OrdT : struct, Ord <T> => set.Count();