コード例 #1
0
ファイル: AbstractSet.cs プロジェクト: VikKol/commonsfornet
        public IStrictSet <T> Intersect(IStrictSet <T> other)
        {
            other.ValidateNotNull("The set is null!");
            var itemArray = new T[Count];
            var index     = 0;

            foreach (var item in Items)
            {
                if (!other.Contains(item))
                {
                    itemArray[index++] = item;
                }
            }

            foreach (var item in itemArray)
            {
                if (item == null)
                {
                    break;
                }
                Remove(item);
            }

            return(this);
        }
コード例 #2
0
ファイル: AbstractSet.cs プロジェクト: VikKol/commonsfornet
        public bool IsSubsetOf(IStrictSet <T> other)
        {
            other.ValidateNotNull("The set is null!");
            var isSubset = true;

            foreach (var item in Items)
            {
                if (!other.Contains(item))
                {
                    isSubset = false;
                    break;
                }
            }

            return(isSubset);
        }