Example #1
0
        public bool IsSubsetOf(IEnumerable <T> other)
        {
            if (other == null)
            {
                throw new ArgumentNullException();
            }

            MultiSet <T> tmp = new MultiSet <T>(other);

            int count = 0;

            foreach (var element in other)
            {
                if (tmp.Contains(element))
                {
                    continue;
                }
                if (Contains(element))
                {
                    count++;
                    tmp.Add(element);
                }
            }

            if (count == mset.Count)
            {
                return(true);
            }

            return(false);
        }