Пример #1
0
        internal Set(IEnumerable <T> items)
        {
            set = SetItem <T> .Empty;

            // TODO: Perf
            foreach (var item in items)
            {
                set = SetModule.Add(set, item, Comparer <T> .Default);
            }
        }
Пример #2
0
        /// <summary>
        /// Ctor that takes an initial (distinct) set of items
        /// </summary>
        /// <param name="items"></param>
        internal Set(IEnumerable <T> items, bool checkUniqueness = false)
        {
            set = SetItem <T> .Empty;

            if (checkUniqueness)
            {
                foreach (var item in items)
                {
                    set = SetModule.TryAdd(set, item, Comparer <T> .Default);
                }
            }
            else
            {
                foreach (var item in items)
                {
                    set = SetModule.Add(set, item, Comparer <T> .Default);
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Ctor that takes an initial (distinct) set of items
        /// </summary>
        /// <param name="items"></param>
        internal SetInternal(IEnumerable <A> items, bool tryAdd)
        {
            set = SetItem <A> .Empty;

            if (tryAdd)
            {
                foreach (var item in items)
                {
                    set = SetModule.TryAdd <OrdA, A>(set, item);
                }
            }
            else
            {
                foreach (var item in items)
                {
                    set = SetModule.Add <OrdA, A>(set, item);
                }
            }
        }
Пример #4
0
 public SetInternal <OrdA, A> Add(A value) =>
 new SetInternal <OrdA, A>(SetModule.Add <OrdA, A>(set, value));
Пример #5
0
 public Set <T> Add(T value) =>
 new Set <T>(SetModule.Add(set, value, Comparer <T> .Default));