private static ValuePair CalculateMatches(IIndexedSet <T> set, IEnumerable <T> other, int count)
        {
            int num  = 0;
            int num2 = 0;

            if (count > 0)
            {
                BitArray flags = new BitArray(count);
                foreach (T item in other)
                {
                    int index = set.IndexOf(item);
                    if (index >= 0)
                    {
                        if (!flags[index])
                        {
                            flags[index] = true;
                            num++;
                        }
                    }
                    else
                    {
                        num2++;
                    }
                }
            }
            else if (other.Any())
            {
                num2++;
            }
            return(new ValuePair
            {
                overlapCount = num,
                exceptCount = num2,
            });
        }
        private static ValuePair CalculateExcept(IIndexedSet <T> set, IEnumerable <T> other, int count)
        {
            int num  = 0;
            int num2 = 0;

            if (count > 0)
            {
                BitArray flags = new BitArray(count);
                using (IEnumerator <T> enumerator = other.GetEnumerator())
                {
                    while ((enumerator.MoveNext()) && (num2 == 0))
                    {
                        T   item  = enumerator.Current;
                        int index = set.IndexOf(item);
                        if (index >= 0)
                        {
                            if (!flags[index])
                            {
                                flags[index] = true;
                                num++;
                            }
                        }
                        else
                        {
                            num2++;
                        }
                    }
                }
            }
            else if (other.Any())
            {
                num2++;
            }
            return(new ValuePair
            {
                overlapCount = num,
                exceptCount = num2,
            });
        }
 public IndexedSetHelper(IIndexedSet <T> set, int count)
 {
     this.set   = set;
     this.count = count;
 }
        public static bool SetEquals(IIndexedSet <T> set, IEnumerable <T> other, int count)
        {
            ValuePair pair = CalculateExcept(set, other, count);

            return((pair.overlapCount == set.Count) && (pair.exceptCount == 0));
        }
 public static bool SetEquals(IIndexedSet <T> set, IEnumerable <T> other)
 {
     return(SetEquals(set, other, set.Count));
 }
        public static bool IsProperSubsetOf(IIndexedSet <T> set, IEnumerable <T> other, int count)
        {
            ValuePair pair = CalculateMatches(set, other, count);

            return((pair.overlapCount == set.Count) && (pair.exceptCount > 0));
        }
 public static bool IsProperSubsetOf(IIndexedSet <T> set, IEnumerable <T> other)
 {
     return(IsProperSubsetOf(set, other, set.Count));
 }