// int
        public static int Min(this EmptyEnumerable <int> source)
        {
            if (source.IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized(nameof(source));
            }

            throw CommonImplementation.SequenceEmpty();
        }
Esempio n. 2
0
        public static System.Collections.Generic.List <TItem> List <TItem>(EmptyEnumerable <TItem> second)
        {
            if (second.IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized(nameof(second));
            }

            return(new System.Collections.Generic.List <TItem>());
        }
        // decimal?
        public static decimal?Min(this EmptyEnumerable <decimal?> source)
        {
            if (source.IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized(nameof(source));
            }

            return(null);
        }
        public static decimal Average(this EmptyEnumerable <decimal> source)
        {
            if (source.IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized(nameof(source));
            }

            throw CommonImplementation.SequenceEmpty();
        }
        public static double?Average(this EmptyEnumerable <long?> source)
        {
            if (source.IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized(nameof(source));
            }

            return(null);
        }
Esempio n. 6
0
        public bool SequenceEqual(EmptyEnumerable <TItem> second, IEqualityComparer <TItem> comparer)
        {
            if (IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized("first");
            }
            if (second.IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized(nameof(second));
            }

            return(InnerCount == 0);
        }
        public bool SequenceEqual(EmptyEnumerable <TItem> second)
        {
            if (IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized("first");
            }
            if (second.IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized(nameof(second));
            }

            return(false);
        }
Esempio n. 8
0
        public bool SequenceEqual(EmptyEnumerable <TItem> second, IEqualityComparer <TItem> comparer)
        {
            if (IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized("source");
            }
            if (second.IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized(nameof(second));
            }

            var asICollection = this.Inner as ICollection <TItem>;

            if (asICollection != null)
            {
                return(asICollection.Count == 0);
            }

            return(CommonImplementation.SequenceEqualImpl <TItem, IdentityEnumerable <TItem, TBridgeType, TBridger, TEnumerator>, TEnumerator, EmptyEnumerable <TItem>, EmptyEnumerator <TItem> >(ref this, ref second, comparer));
        }
        // Concat

        public static IdentityEnumerable <TItem, LinkedList <TItem>, LinkedListBridger <TItem>, LinkedListEnumerator <TItem> > Concat <TItem>(this LinkedList <TItem> first, EmptyEnumerable <TItem> second)
        {
            var firstBridge = CommonImplementation.Bridge(first, nameof(first));

            if (second.IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized(nameof(second));
            }

            return(firstBridge);
        }
        // Concat

        public static IdentityEnumerable <TItem, Dictionary <TItem, TDictionaryValue> .KeyCollection, DictionaryKeysBridger <TItem, TDictionaryValue>, DictionaryKeysEnumerator <TItem, TDictionaryValue> > Concat <TItem, TDictionaryValue>(this Dictionary <TItem, TDictionaryValue> .KeyCollection first, EmptyEnumerable <TItem> second)
        {
            var firstBridge = CommonImplementation.Bridge(first, nameof(first));

            if (second.IsDefaultValue())
            {
                throw CommonImplementation.Uninitialized(nameof(second));
            }

            return(firstBridge);
        }
Esempio n. 11
0
 public bool SequenceEqual(EmptyEnumerable <int> second) => SequenceEqual(second, null);