示例#1
0
        /// <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);
        }
示例#2
0
 public static int length <T>(Set <T> set) =>
 set.Count();
示例#3
0
 public static int length <OrdT, T>(Set <OrdT, T> set) where OrdT : struct, Ord <T> =>
 set.Count();