8 [global::__DynamicallyInvokable]
17 internal TSource current;
19 public TSource Current => current;
34 public abstract Iterator<TSource> Clone();
36 public virtual void Dispose()
38 current =
default(TSource);
49 Iterator<TSource> iterator = Clone();
54 public abstract bool MoveNext();
62 return GetEnumerator();
71 private class WhereEnumerableIterator<TSource> : Iterator<TSource>
75 private Func<TSource, bool> predicate;
82 this.predicate = predicate;
85 public override Iterator<TSource> Clone()
87 return new WhereEnumerableIterator<TSource>(source, predicate);
90 public override void Dispose()
92 if (enumerator !=
null)
100 public override bool MoveNext()
102 int state = base.state;
117 TSource current = enumerator.
Current;
118 if (predicate(current))
120 base.current = current;
132 return new WhereSelectEnumerableIterator<TSource, TResult>(source, predicate, selector);
137 return new WhereEnumerableIterator<TSource>(source, CombinePredicates(this.predicate, predicate));
141 private class WhereArrayIterator<TSource> : Iterator<TSource>
143 private TSource[] source;
145 private Func<TSource, bool> predicate;
149 public WhereArrayIterator(TSource[] source, Func<TSource, bool> predicate)
151 this.source = source;
152 this.predicate = predicate;
155 public override Iterator<TSource> Clone()
157 return new WhereArrayIterator<TSource>(source, predicate);
160 public override bool MoveNext()
164 while (index < source.Length)
166 TSource val = source[index];
181 return new WhereSelectArrayIterator<TSource, TResult>(source, predicate, selector);
186 return new WhereArrayIterator<TSource>(source, CombinePredicates(this.predicate, predicate));
190 private class WhereListIterator<TSource> : Iterator<TSource>
194 private Func<TSource, bool> predicate;
198 public WhereListIterator(
List<TSource> source, Func<TSource, bool> predicate)
200 this.source = source;
201 this.predicate = predicate;
204 public override Iterator<TSource> Clone()
206 return new WhereListIterator<TSource>(source, predicate);
209 public override bool MoveNext()
211 int state = base.state;
224 while (enumerator.MoveNext())
226 TSource current = enumerator.Current;
227 if (predicate(current))
229 base.current = current;
241 return new WhereSelectListIterator<TSource, TResult>(source, predicate, selector);
246 return new WhereListIterator<TSource>(source, CombinePredicates(this.predicate, predicate));
250 private class SelectEnumerableIterator<TSource, TResult> : Iterator<TResult>, IIListProvider<TResult>,
IEnumerable<TResult>,
IEnumerable 254 private readonly Func<TSource, TResult> _selector;
261 _selector = selector;
264 public override Iterator<TResult> Clone()
266 return new SelectEnumerableIterator<TSource, TResult>(_source, _selector);
269 public override void Dispose()
271 if (_enumerator !=
null)
273 _enumerator.Dispose();
279 public override bool MoveNext()
281 int state = base.state;
291 _enumerator = _source.GetEnumerator();
296 current = _selector(_enumerator.
Current);
307 return new SelectEnumerableIterator<TSource, TResult2>(_source, CombineSelectors(_selector, selector));
312 return new WhereEnumerableIterator<TResult>(
this, predicate);
315 public TResult[] ToArray()
317 LargeArrayBuilder<TResult> largeArrayBuilder =
new LargeArrayBuilder<TResult>(initialize:
true);
318 foreach (TSource item
in _source)
320 largeArrayBuilder.Add(_selector(item));
322 return largeArrayBuilder.ToArray();
328 foreach (TSource item
in _source)
330 list.Add(_selector(item));
335 public int GetCount(
bool onlyIfCheap)
342 foreach (TSource item
in _source)
345 num = checked(num + 1);
351 private class WhereSelectEnumerableIterator<TSource, TResult> : Iterator<TResult>
355 private Func<TSource, bool> predicate;
357 private Func<TSource, TResult> selector;
361 public WhereSelectEnumerableIterator(
IEnumerable<TSource> source, Func<TSource, bool> predicate, Func<TSource, TResult> selector)
363 this.source = source;
364 this.predicate = predicate;
365 this.selector = selector;
368 public override Iterator<TResult> Clone()
370 return new WhereSelectEnumerableIterator<TSource, TResult>(source, predicate, selector);
373 public override void Dispose()
375 if (enumerator !=
null)
377 enumerator.Dispose();
383 public override bool MoveNext()
385 int state = base.state;
400 TSource current = enumerator.
Current;
401 if (predicate ==
null || predicate(current))
403 base.current = selector(current);
415 return new WhereSelectEnumerableIterator<TSource, TResult2>(source, predicate, CombineSelectors(this.selector, selector));
420 return new WhereEnumerableIterator<TResult>(
this, predicate);
424 private class WhereSelectArrayIterator<TSource, TResult> : Iterator<TResult>
426 private TSource[] source;
428 private Func<TSource, bool> predicate;
430 private Func<TSource, TResult> selector;
434 public WhereSelectArrayIterator(TSource[] source, Func<TSource, bool> predicate, Func<TSource, TResult> selector)
436 this.source = source;
437 this.predicate = predicate;
438 this.selector = selector;
441 public override Iterator<TResult> Clone()
443 return new WhereSelectArrayIterator<TSource, TResult>(source, predicate, selector);
446 public override bool MoveNext()
450 while (index < source.Length)
452 TSource arg = source[index];
454 if (predicate ==
null || predicate(arg))
456 current = selector(arg);
467 return new WhereSelectArrayIterator<TSource, TResult2>(source, predicate, CombineSelectors(this.selector, selector));
472 return new WhereEnumerableIterator<TResult>(
this, predicate);
476 private class WhereSelectListIterator<TSource, TResult> : Iterator<TResult>
480 private Func<TSource, bool> predicate;
482 private Func<TSource, TResult> selector;
486 public WhereSelectListIterator(
List<TSource> source, Func<TSource, bool> predicate, Func<TSource, TResult> selector)
488 this.source = source;
489 this.predicate = predicate;
490 this.selector = selector;
493 public override Iterator<TResult> Clone()
495 return new WhereSelectListIterator<TSource, TResult>(source, predicate, selector);
498 public override bool MoveNext()
500 int state = base.state;
513 while (enumerator.MoveNext())
515 TSource current = enumerator.Current;
516 if (predicate ==
null || predicate(current))
518 base.current = selector(current);
530 return new WhereSelectListIterator<TSource, TResult2>(source, predicate, CombineSelectors(this.selector, selector));
535 return new WhereEnumerableIterator<TResult>(
this, predicate);
539 private abstract class AppendPrependIterator<TSource> : Iterator<TSource>, IIListProvider<TSource>,
IEnumerable<TSource>,
IEnumerable 550 protected void GetSourceEnumerator()
552 enumerator = _source.GetEnumerator();
555 public abstract AppendPrependIterator<TSource> Append(TSource item);
557 public abstract AppendPrependIterator<TSource> Prepend(TSource item);
559 protected bool LoadFromEnumerator()
570 public override void Dispose()
572 if (enumerator !=
null)
574 enumerator.Dispose();
582 return new SelectEnumerableIterator<TSource, TResult>(
this, selector);
587 return new WhereEnumerableIterator<TSource>(
this, predicate);
590 public abstract TSource[] ToArray();
594 public abstract int GetCount(
bool onlyIfCheap);
597 private class AppendPrepend1Iterator<TSource> : AppendPrependIterator<TSource>
599 private readonly TSource _item;
601 private readonly
bool _appending;
607 _appending = appending;
610 public override Iterator<TSource> Clone()
612 return new AppendPrepend1Iterator<TSource>(_source, _item, _appending);
615 public override bool MoveNext()
628 GetSourceEnumerator();
632 if (LoadFromEnumerator())
647 public override AppendPrependIterator<TSource> Append(TSource item)
651 return new AppendPrependN<TSource>(_source,
null,
new SingleLinkedNode<TSource>(_item).
Add(item), 0, 2);
653 return new AppendPrependN<TSource>(_source,
new SingleLinkedNode<TSource>(_item),
new SingleLinkedNode<TSource>(item), 1, 1);
656 public override AppendPrependIterator<TSource> Prepend(TSource item)
660 return new AppendPrependN<TSource>(_source,
new SingleLinkedNode<TSource>(item),
new SingleLinkedNode<TSource>(_item), 1, 1);
662 return new AppendPrependN<TSource>(_source,
new SingleLinkedNode<TSource>(_item).
Add(item),
null, 2, 0);
665 private TSource[] LazyToArray()
667 LargeArrayBuilder<TSource> largeArrayBuilder =
new LargeArrayBuilder<TSource>(initialize:
true);
670 largeArrayBuilder.SlowAdd(_item);
672 largeArrayBuilder.AddRange(_source);
675 largeArrayBuilder.SlowAdd(_item);
677 return largeArrayBuilder.ToArray();
680 public override TSource[] ToArray()
682 int count = GetCount(onlyIfCheap:
true);
685 return LazyToArray();
687 TSource[] array =
new TSource[count];
698 EnumerableHelpers.Copy(_source, array, arrayIndex, count - 1);
701 array[array.Length - 1] = _item;
708 int count = GetCount(onlyIfCheap:
true);
714 list.AddRange(_source);
722 public override int GetCount(
bool onlyIfCheap)
724 IIListProvider<TSource> iIListProvider = _source as IIListProvider<TSource>;
725 if (iIListProvider !=
null)
727 int count = iIListProvider.GetCount(onlyIfCheap);
738 return _source.Count() + 1;
742 private class AppendPrependN<TSource> : AppendPrependIterator<TSource>
744 private readonly SingleLinkedNode<TSource> _prepended;
746 private readonly SingleLinkedNode<TSource> _appended;
748 private readonly
int _prependCount;
750 private readonly
int _appendCount;
752 private SingleLinkedNode<TSource> _node;
754 public AppendPrependN(
IEnumerable<TSource> source, SingleLinkedNode<TSource> prepended, SingleLinkedNode<TSource> appended,
int prependCount,
int appendCount)
757 _prepended = prepended;
758 _appended = appended;
759 _prependCount = prependCount;
760 _appendCount = appendCount;
763 public override Iterator<TSource> Clone()
765 return new AppendPrependN<TSource>(_source, _prepended, _appended, _prependCount, _appendCount);
768 public override bool MoveNext()
779 current = _node.Item;
780 _node = _node.Linked;
783 GetSourceEnumerator();
787 if (LoadFromEnumerator())
791 if (_appended ==
null)
795 enumerator = _appended.GetEnumerator(_appendCount);
799 return LoadFromEnumerator();
806 public override AppendPrependIterator<TSource> Append(TSource item)
808 SingleLinkedNode<TSource> appended = (_appended !=
null) ? _appended.Add(item) :
new SingleLinkedNode<TSource>(item);
809 return new AppendPrependN<TSource>(_source, _prepended, appended, _prependCount, _appendCount + 1);
812 public override AppendPrependIterator<TSource> Prepend(TSource item)
814 SingleLinkedNode<TSource> prepended = (_prepended !=
null) ? _prepended.Add(item) :
new SingleLinkedNode<TSource>(item);
815 return new AppendPrependN<TSource>(_source, prepended, _appended, _prependCount + 1, _appendCount);
818 private TSource[] LazyToArray()
820 SparseArrayBuilder<TSource> sparseArrayBuilder =
new SparseArrayBuilder<TSource>(initialize:
true);
821 if (_prepended !=
null)
823 sparseArrayBuilder.Reserve(_prependCount);
825 sparseArrayBuilder.AddRange(_source);
826 if (_appended !=
null)
828 sparseArrayBuilder.Reserve(_appendCount);
830 TSource[] array = sparseArrayBuilder.ToArray();
832 for (SingleLinkedNode<TSource> singleLinkedNode = _prepended; singleLinkedNode !=
null; singleLinkedNode = singleLinkedNode.Linked)
834 array[num++] = singleLinkedNode.Item;
836 num = array.Length - 1;
837 for (SingleLinkedNode<TSource> singleLinkedNode2 = _appended; singleLinkedNode2 !=
null; singleLinkedNode2 = singleLinkedNode2.Linked)
839 array[num--] = singleLinkedNode2.Item;
844 public override TSource[] ToArray()
846 int count = GetCount(onlyIfCheap:
true);
849 return LazyToArray();
851 TSource[] array =
new TSource[count];
853 for (SingleLinkedNode<TSource> singleLinkedNode = _prepended; singleLinkedNode !=
null; singleLinkedNode = singleLinkedNode.Linked)
855 array[num] = singleLinkedNode.Item;
859 if (collection !=
null)
861 collection.CopyTo(array, num);
865 foreach (TSource item
in _source)
867 TSource val = array[num] = item;
872 for (SingleLinkedNode<TSource> singleLinkedNode2 = _appended; singleLinkedNode2 !=
null; singleLinkedNode2 = singleLinkedNode2.Linked)
875 array[num] = singleLinkedNode2.Item;
882 int count = GetCount(onlyIfCheap:
true);
884 for (SingleLinkedNode<TSource> singleLinkedNode = _prepended; singleLinkedNode !=
null; singleLinkedNode = singleLinkedNode.Linked)
886 list.Add(singleLinkedNode.Item);
888 list.AddRange(_source);
889 if (_appended !=
null)
900 public override int GetCount(
bool onlyIfCheap)
902 IIListProvider<TSource> iIListProvider = _source as IIListProvider<TSource>;
903 if (iIListProvider !=
null)
905 int count = iIListProvider.GetCount(onlyIfCheap);
908 return count + _appendCount + _prependCount;
916 return _source.Count() + _appendCount + _prependCount;
927 [global::__DynamicallyInvokable]
932 throw Error.ArgumentNull(
"source");
934 if (predicate ==
null)
936 throw Error.ArgumentNull(
"predicate");
938 if (source is Iterator<TSource>)
940 return ((Iterator<TSource>)source).Where(predicate);
942 if (source is TSource[])
944 return new WhereArrayIterator<TSource>((TSource[])source, predicate);
948 return new WhereListIterator<TSource>((
List<TSource>)source, predicate);
950 return new WhereEnumerableIterator<TSource>(source, predicate);
960 [global::__DynamicallyInvokable]
965 throw Error.ArgumentNull(
"source");
967 if (predicate ==
null)
969 throw Error.ArgumentNull(
"predicate");
971 return WhereIterator(source, predicate);
977 foreach (TSource item
in source)
979 index = checked(index + 1);
980 if (predicate(item, index))
995 [global::__DynamicallyInvokable]
1000 throw Error.ArgumentNull(
"source");
1002 if (selector ==
null)
1004 throw Error.ArgumentNull(
"selector");
1006 if (source is Iterator<TSource>)
1008 return ((Iterator<TSource>)source).Select(selector);
1010 if (source is TSource[])
1012 return new WhereSelectArrayIterator<TSource, TResult>((TSource[])source,
null, selector);
1016 return new WhereSelectListIterator<TSource, TResult>((
List<TSource>)source,
null, selector);
1018 return new WhereSelectEnumerableIterator<TSource, TResult>(source,
null, selector);
1029 [global::__DynamicallyInvokable]
1034 throw Error.ArgumentNull(
"source");
1036 if (selector ==
null)
1038 throw Error.ArgumentNull(
"selector");
1040 return SelectIterator(source, selector);
1046 foreach (TSource item
in source)
1048 index = checked(index + 1);
1049 yield
return selector(item, index);
1053 private static Func<TSource, bool> CombinePredicates<TSource>(Func<TSource, bool> predicate1, Func<TSource, bool> predicate2)
1055 return delegate(TSource x)
1059 return predicate2(x);
1065 private static Func<TSource, TResult> CombineSelectors<TSource, TMiddle, TResult>(Func<TSource, TMiddle> selector1, Func<TMiddle, TResult> selector2)
1067 return (TSource x) => selector2(selector1(x));
1078 [global::__DynamicallyInvokable]
1083 throw Error.ArgumentNull(
"source");
1085 if (selector ==
null)
1087 throw Error.ArgumentNull(
"selector");
1089 return SelectManyIterator(source, selector);
1094 foreach (TSource item
in source)
1096 foreach (TResult item2
in selector(item))
1111 [global::__DynamicallyInvokable]
1116 throw Error.ArgumentNull(
"source");
1118 if (selector ==
null)
1120 throw Error.ArgumentNull(
"selector");
1122 return SelectManyIterator(source, selector);
1128 foreach (TSource item
in source)
1130 index = checked(index + 1);
1131 foreach (TResult item2
in selector(item, index))
1148 [global::__DynamicallyInvokable]
1153 throw Error.ArgumentNull(
"source");
1155 if (collectionSelector ==
null)
1157 throw Error.ArgumentNull(
"collectionSelector");
1159 if (resultSelector ==
null)
1161 throw Error.ArgumentNull(
"resultSelector");
1163 return SelectManyIterator(source, collectionSelector, resultSelector);
1169 foreach (TSource element
in source)
1171 index = checked(index + 1);
1172 foreach (TCollection item
in collectionSelector(element, index))
1174 yield
return resultSelector(element, item);
1189 [global::__DynamicallyInvokable]
1194 throw Error.ArgumentNull(
"source");
1196 if (collectionSelector ==
null)
1198 throw Error.ArgumentNull(
"collectionSelector");
1200 if (resultSelector ==
null)
1202 throw Error.ArgumentNull(
"resultSelector");
1204 return SelectManyIterator(source, collectionSelector, resultSelector);
1209 foreach (TSource element
in source)
1211 foreach (TCollection item
in collectionSelector(element))
1213 yield
return resultSelector(element, item);
1225 [global::__DynamicallyInvokable]
1230 throw Error.ArgumentNull(
"source");
1232 return TakeIterator(source, count);
1239 foreach (TSource item
in source)
1242 int num = count - 1;
1259 [global::__DynamicallyInvokable]
1264 throw Error.ArgumentNull(
"source");
1266 if (predicate ==
null)
1268 throw Error.ArgumentNull(
"predicate");
1270 return TakeWhileIterator(source, predicate);
1275 foreach (TSource item
in source)
1277 if (!predicate(item))
1292 [global::__DynamicallyInvokable]
1297 throw Error.ArgumentNull(
"source");
1299 if (predicate ==
null)
1301 throw Error.ArgumentNull(
"predicate");
1303 return TakeWhileIterator(source, predicate);
1309 foreach (TSource item
in source)
1311 index = checked(index + 1);
1312 if (!predicate(item, index))
1327 [global::__DynamicallyInvokable]
1332 throw Error.ArgumentNull(
"source");
1334 return SkipIterator(source, count);
1362 [global::__DynamicallyInvokable]
1367 throw Error.ArgumentNull(
"source");
1369 if (predicate ==
null)
1371 throw Error.ArgumentNull(
"predicate");
1373 return SkipWhileIterator(source, predicate);
1378 bool yielding =
false;
1379 foreach (TSource item
in source)
1381 if (!yielding && !predicate(item))
1399 [global::__DynamicallyInvokable]
1404 throw Error.ArgumentNull(
"source");
1406 if (predicate ==
null)
1408 throw Error.ArgumentNull(
"predicate");
1410 return SkipWhileIterator(source, predicate);
1416 bool yielding =
false;
1417 foreach (TSource item
in source)
1419 index = checked(index + 1);
1420 if (!yielding && !predicate(item, index))
1444 [global::__DynamicallyInvokable]
1445 public static IEnumerable<TResult> Join<TOuter, TInner, TKey, TResult>(
this IEnumerable<TOuter> outer,
IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector)
1449 throw Error.ArgumentNull(
"outer");
1453 throw Error.ArgumentNull(
"inner");
1455 if (outerKeySelector ==
null)
1457 throw Error.ArgumentNull(
"outerKeySelector");
1459 if (innerKeySelector ==
null)
1461 throw Error.ArgumentNull(
"innerKeySelector");
1463 if (resultSelector ==
null)
1465 throw Error.ArgumentNull(
"resultSelector");
1467 return JoinIterator(outer, inner, outerKeySelector, innerKeySelector, resultSelector,
null);
1484 [global::__DynamicallyInvokable]
1485 public static IEnumerable<TResult> Join<TOuter, TInner, TKey, TResult>(
this IEnumerable<TOuter> outer,
IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector,
IEqualityComparer<TKey> comparer)
1489 throw Error.ArgumentNull(
"outer");
1493 throw Error.ArgumentNull(
"inner");
1495 if (outerKeySelector ==
null)
1497 throw Error.ArgumentNull(
"outerKeySelector");
1499 if (innerKeySelector ==
null)
1501 throw Error.ArgumentNull(
"innerKeySelector");
1503 if (resultSelector ==
null)
1505 throw Error.ArgumentNull(
"resultSelector");
1507 return JoinIterator(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer);
1510 private static IEnumerable<TResult> JoinIterator<TOuter, TInner, TKey, TResult>(
IEnumerable<TOuter> outer,
IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector,
IEqualityComparer<TKey> comparer)
1513 foreach (TOuter item
in outer)
1518 for (
int i = 0; i < g.count; i++)
1520 yield
return resultSelector(item, g.elements[i]);
1539 [global::__DynamicallyInvokable]
1540 public static IEnumerable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(
this IEnumerable<TOuter> outer,
IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter,
IEnumerable<TInner>, TResult> resultSelector)
1544 throw Error.ArgumentNull(
"outer");
1548 throw Error.ArgumentNull(
"inner");
1550 if (outerKeySelector ==
null)
1552 throw Error.ArgumentNull(
"outerKeySelector");
1554 if (innerKeySelector ==
null)
1556 throw Error.ArgumentNull(
"innerKeySelector");
1558 if (resultSelector ==
null)
1560 throw Error.ArgumentNull(
"resultSelector");
1562 return GroupJoinIterator(outer, inner, outerKeySelector, innerKeySelector, resultSelector,
null);
1579 [global::__DynamicallyInvokable]
1580 public static IEnumerable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(
this IEnumerable<TOuter> outer,
IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter,
IEnumerable<TInner>, TResult> resultSelector,
IEqualityComparer<TKey> comparer)
1584 throw Error.ArgumentNull(
"outer");
1588 throw Error.ArgumentNull(
"inner");
1590 if (outerKeySelector ==
null)
1592 throw Error.ArgumentNull(
"outerKeySelector");
1594 if (innerKeySelector ==
null)
1596 throw Error.ArgumentNull(
"innerKeySelector");
1598 if (resultSelector ==
null)
1600 throw Error.ArgumentNull(
"resultSelector");
1602 return GroupJoinIterator(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer);
1605 private static IEnumerable<TResult> GroupJoinIterator<TOuter, TInner, TKey, TResult>(
IEnumerable<TOuter> outer,
IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter,
IEnumerable<TInner>, TResult> resultSelector,
IEqualityComparer<TKey> comparer)
1608 foreach (TOuter item
in outer)
1610 yield
return resultSelector(item, lookup[outerKeySelector(item)]);
1622 [global::__DynamicallyInvokable]
1625 return new OrderedEnumerable<TSource, TKey>(source, keySelector,
null, descending:
false);
1637 [global::__DynamicallyInvokable]
1640 return new OrderedEnumerable<TSource, TKey>(source, keySelector, comparer, descending:
false);
1651 [global::__DynamicallyInvokable]
1654 return new OrderedEnumerable<TSource, TKey>(source, keySelector,
null, descending:
true);
1666 [global::__DynamicallyInvokable]
1669 return new OrderedEnumerable<TSource, TKey>(source, keySelector, comparer, descending:
true);
1680 [global::__DynamicallyInvokable]
1685 throw Error.ArgumentNull(
"source");
1687 return source.CreateOrderedEnumerable(keySelector,
null, descending:
false);
1699 [global::__DynamicallyInvokable]
1704 throw Error.ArgumentNull(
"source");
1706 return source.CreateOrderedEnumerable(keySelector, comparer, descending:
false);
1717 [global::__DynamicallyInvokable]
1722 throw Error.ArgumentNull(
"source");
1724 return source.CreateOrderedEnumerable(keySelector,
null, descending:
true);
1736 [global::__DynamicallyInvokable]
1741 throw Error.ArgumentNull(
"source");
1743 return source.CreateOrderedEnumerable(keySelector, comparer, descending:
true);
1754 [global::__DynamicallyInvokable]
1757 return new GroupedEnumerable<TSource, TKey, TSource>(source, keySelector, IdentityFunction<TSource>.Instance,
null);
1769 [global::__DynamicallyInvokable]
1772 return new GroupedEnumerable<TSource, TKey, TSource>(source, keySelector, IdentityFunction<TSource>.Instance, comparer);
1785 [global::__DynamicallyInvokable]
1788 return new GroupedEnumerable<TSource, TKey, TElement>(source, keySelector, elementSelector,
null);
1802 [global::__DynamicallyInvokable]
1805 return new GroupedEnumerable<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);
1816 [global::__DynamicallyInvokable]
1819 return new GroupedEnumerable<TSource, TKey, TSource, TResult>(source, keySelector, IdentityFunction<TSource>.Instance, resultSelector,
null);
1832 [global::__DynamicallyInvokable]
1833 public static IEnumerable<TResult> GroupBy<TSource, TKey, TElement, TResult>(
this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey,
IEnumerable<TElement>, TResult> resultSelector)
1835 return new GroupedEnumerable<TSource, TKey, TElement, TResult>(source, keySelector, elementSelector, resultSelector,
null);
1847 [global::__DynamicallyInvokable]
1850 return new GroupedEnumerable<TSource, TKey, TSource, TResult>(source, keySelector, IdentityFunction<TSource>.Instance, resultSelector, comparer);
1864 [global::__DynamicallyInvokable]
1865 public static IEnumerable<TResult> GroupBy<TSource, TKey, TElement, TResult>(
this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey,
IEnumerable<TElement>, TResult> resultSelector,
IEqualityComparer<TKey> comparer)
1867 return new GroupedEnumerable<TSource, TKey, TElement, TResult>(source, keySelector, elementSelector, resultSelector, comparer);
1877 [global::__DynamicallyInvokable]
1882 throw Error.ArgumentNull(
"first");
1886 throw Error.ArgumentNull(
"second");
1888 return ConcatIterator(first, second);
1893 foreach (TSource item
in first)
1897 foreach (TSource item2
in second)
1913 [global::__DynamicallyInvokable]
1918 throw Error.ArgumentNull(
"first");
1922 throw Error.ArgumentNull(
"second");
1924 if (resultSelector ==
null)
1926 throw Error.ArgumentNull(
"resultSelector");
1928 return ZipIterator(first, second, resultSelector);
1951 [global::__DynamicallyInvokable]
1956 throw Error.ArgumentNull(
"source");
1958 return DistinctIterator(source,
null);
1968 [global::__DynamicallyInvokable]
1973 throw Error.ArgumentNull(
"source");
1975 return DistinctIterator(source, comparer);
1980 Set<TSource>
set =
new Set<TSource>(comparer);
1981 foreach (TSource item
in source)
1997 [global::__DynamicallyInvokable]
2002 throw Error.ArgumentNull(
"first");
2006 throw Error.ArgumentNull(
"second");
2008 return UnionIterator(first, second,
null);
2019 [global::__DynamicallyInvokable]
2024 throw Error.ArgumentNull(
"first");
2028 throw Error.ArgumentNull(
"second");
2030 return UnionIterator(first, second, comparer);
2035 Set<TSource>
set =
new Set<TSource>(comparer);
2036 foreach (TSource item
in first)
2043 foreach (TSource item2
in second)
2059 [global::__DynamicallyInvokable]
2064 throw Error.ArgumentNull(
"first");
2068 throw Error.ArgumentNull(
"second");
2070 return IntersectIterator(first, second,
null);
2081 [global::__DynamicallyInvokable]
2086 throw Error.ArgumentNull(
"first");
2090 throw Error.ArgumentNull(
"second");
2092 return IntersectIterator(first, second, comparer);
2097 Set<TSource>
set =
new Set<TSource>(comparer);
2098 foreach (TSource item
in second)
2102 foreach (TSource item2
in first)
2104 if (
set.Remove(item2))
2118 [global::__DynamicallyInvokable]
2123 throw Error.ArgumentNull(
"first");
2127 throw Error.ArgumentNull(
"second");
2129 return ExceptIterator(first, second,
null);
2140 [global::__DynamicallyInvokable]
2145 throw Error.ArgumentNull(
"first");
2149 throw Error.ArgumentNull(
"second");
2151 return ExceptIterator(first, second, comparer);
2156 Set<TSource>
set =
new Set<TSource>(comparer);
2157 foreach (TSource item
in second)
2161 foreach (TSource item2
in first)
2176 [global::__DynamicallyInvokable]
2181 throw Error.ArgumentNull(
"source");
2183 return ReverseIterator(source);
2188 Buffer<TSource> buffer =
new Buffer<TSource>(source);
2189 for (
int i = buffer.count - 1; i >= 0; i--)
2191 yield
return buffer.items[i];
2203 [global::__DynamicallyInvokable]
2206 return first.SequenceEqual(second,
null);
2218 [global::__DynamicallyInvokable]
2221 if (comparer ==
null)
2227 throw Error.ArgumentNull(
"first");
2231 throw Error.ArgumentNull(
"second");
2257 [global::__DynamicallyInvokable]
2269 [global::__DynamicallyInvokable]
2274 throw Error.ArgumentNull(
"source");
2276 return new Buffer<TSource>(source).ToArray();
2285 [global::__DynamicallyInvokable]
2290 throw Error.ArgumentNull(
"source");
2306 [global::__DynamicallyInvokable]
2309 return source.ToDictionary(keySelector, IdentityFunction<TSource>.Instance,
null);
2324 [global::__DynamicallyInvokable]
2327 return source.ToDictionary(keySelector, IdentityFunction<TSource>.Instance, comparer);
2343 [global::__DynamicallyInvokable]
2346 return source.ToDictionary(keySelector, elementSelector,
null);
2363 [global::__DynamicallyInvokable]
2368 throw Error.ArgumentNull(
"source");
2370 if (keySelector ==
null)
2372 throw Error.ArgumentNull(
"keySelector");
2374 if (elementSelector ==
null)
2376 throw Error.ArgumentNull(
"elementSelector");
2379 foreach (TSource item
in source)
2381 dictionary.Add(keySelector(item), elementSelector(item));
2394 [global::__DynamicallyInvokable]
2409 [global::__DynamicallyInvokable]
2412 return Lookup<TKey, TSource>.Create(source, keySelector, IdentityFunction<TSource>.Instance, comparer);
2425 [global::__DynamicallyInvokable]
2442 [global::__DynamicallyInvokable]
2454 [global::__DynamicallyInvokable]
2457 return source.DefaultIfEmpty(
default(TSource));
2465 [global::__DynamicallyInvokable]
2470 throw Error.ArgumentNull(
"source");
2472 return DefaultIfEmptyIterator(source, defaultValue);
2489 yield
return defaultValue;
2500 [global::__DynamicallyInvokable]
2505 throw Error.ArgumentNull(
"source");
2507 return OfTypeIterator<TResult>(source);
2512 foreach (
object item
in source)
2514 if (item is TResult)
2516 yield
return (TResult)item;
2528 [global::__DynamicallyInvokable]
2532 if (enumerable !=
null)
2538 throw Error.ArgumentNull(
"source");
2540 return CastIterator<TResult>(source);
2545 foreach (
object item
in source)
2547 yield
return (TResult)item;
2558 [global::__DynamicallyInvokable]
2563 throw Error.ArgumentNull(
"source");
2583 throw Error.NoElements();
2594 [global::__DynamicallyInvokable]
2599 throw Error.ArgumentNull(
"source");
2601 if (predicate ==
null)
2603 throw Error.ArgumentNull(
"predicate");
2605 foreach (TSource item
in source)
2607 if (predicate(item))
2612 throw Error.NoMatch();
2622 [global::__DynamicallyInvokable]
2627 throw Error.ArgumentNull(
"source");
2647 return default(TSource);
2658 [global::__DynamicallyInvokable]
2663 throw Error.ArgumentNull(
"source");
2665 if (predicate ==
null)
2667 throw Error.ArgumentNull(
"predicate");
2669 foreach (TSource item
in source)
2671 if (predicate(item))
2676 return default(TSource);
2686 [global::__DynamicallyInvokable]
2691 throw Error.ArgumentNull(
"source");
2696 int count = list.Count;
2699 return list[count - 1];
2718 throw Error.NoElements();
2729 [global::__DynamicallyInvokable]
2734 throw Error.ArgumentNull(
"source");
2736 if (predicate ==
null)
2738 throw Error.ArgumentNull(
"predicate");
2740 TSource result =
default(TSource);
2742 foreach (TSource item
in source)
2744 if (predicate(item))
2754 throw Error.NoMatch();
2764 [global::__DynamicallyInvokable]
2769 throw Error.ArgumentNull(
"source");
2774 int count = list.Count;
2777 return list[count - 1];
2796 return default(TSource);
2807 [global::__DynamicallyInvokable]
2812 throw Error.ArgumentNull(
"source");
2814 if (predicate ==
null)
2816 throw Error.ArgumentNull(
"predicate");
2818 TSource result =
default(TSource);
2819 foreach (TSource item
in source)
2821 if (predicate(item))
2836 [global::__DynamicallyInvokable]
2841 throw Error.ArgumentNull(
"source");
2849 throw Error.NoElements();
2860 throw Error.NoElements();
2862 TSource current = enumerator.
Current;
2869 throw Error.MoreThanOneElement();
2880 [global::__DynamicallyInvokable]
2885 throw Error.ArgumentNull(
"source");
2887 if (predicate ==
null)
2889 throw Error.ArgumentNull(
"predicate");
2891 TSource result =
default(TSource);
2893 foreach (TSource item
in source)
2895 if (predicate(item))
2898 num = checked(num + 1);
2904 throw Error.NoMatch();
2908 throw Error.MoreThanOneMatch();
2919 [global::__DynamicallyInvokable]
2924 throw Error.ArgumentNull(
"source");
2932 return default(TSource);
2943 return default(TSource);
2945 TSource current = enumerator.
Current;
2952 throw Error.MoreThanOneElement();
2962 [global::__DynamicallyInvokable]
2967 throw Error.ArgumentNull(
"source");
2969 if (predicate ==
null)
2971 throw Error.ArgumentNull(
"predicate");
2973 TSource result =
default(TSource);
2975 foreach (TSource item
in source)
2977 if (predicate(item))
2980 num = checked(num + 1);
2986 return default(TSource);
2990 throw Error.MoreThanOneMatch();
3003 [global::__DynamicallyInvokable]
3008 throw Error.ArgumentNull(
"source");
3017 throw Error.ArgumentOutOfRange(
"index");
3029 throw Error.ArgumentOutOfRange(
"index");
3041 [global::__DynamicallyInvokable]
3046 throw Error.ArgumentNull(
"source");
3053 if (index < list.Count)
3073 return default(TSource);
3083 [global::__DynamicallyInvokable]
3086 long num = (long)start + (
long)count - 1;
3087 if (count < 0 || num >
int.MaxValue)
3089 throw Error.ArgumentOutOfRange(
"count");
3091 return RangeIterator(start, count);
3096 for (
int i = 0; i < count; i++)
3098 yield
return start + i;
3109 [global::__DynamicallyInvokable]
3114 throw Error.ArgumentOutOfRange(
"count");
3116 return RepeatIterator(element, count);
3121 for (
int i = 0; i < count; i++)
3123 yield
return element;
3130 [global::__DynamicallyInvokable]
3133 return EmptyEnumerable<TResult>.Instance;
3143 [global::__DynamicallyInvokable]
3148 throw Error.ArgumentNull(
"source");
3168 [global::__DynamicallyInvokable]
3173 throw Error.ArgumentNull(
"source");
3175 if (predicate ==
null)
3177 throw Error.ArgumentNull(
"predicate");
3179 foreach (TSource item
in source)
3181 if (predicate(item))
3197 [global::__DynamicallyInvokable]
3202 throw Error.ArgumentNull(
"source");
3204 if (predicate ==
null)
3206 throw Error.ArgumentNull(
"predicate");
3208 foreach (TSource item
in source)
3210 if (!predicate(item))
3225 [global::__DynamicallyInvokable]
3230 throw Error.ArgumentNull(
"source");
3233 if (collection !=
null)
3235 return collection.Count;
3238 if (collection2 !=
null)
3240 return collection2.
Count;
3247 num = checked(num + 1);
3261 [global::__DynamicallyInvokable]
3266 throw Error.ArgumentNull(
"source");
3268 if (predicate ==
null)
3270 throw Error.ArgumentNull(
"predicate");
3273 foreach (TSource item
in source)
3275 if (predicate(item))
3277 num = checked(num + 1);
3290 [global::__DynamicallyInvokable]
3295 throw Error.ArgumentNull(
"source");
3302 num = checked(num + 1);
3316 [global::__DynamicallyInvokable]
3321 throw Error.ArgumentNull(
"source");
3323 if (predicate ==
null)
3325 throw Error.ArgumentNull(
"predicate");
3328 foreach (TSource item
in source)
3330 if (predicate(item))
3332 num = checked(num + 1);
3346 [global::__DynamicallyInvokable]
3361 [global::__DynamicallyInvokable]
3364 if (comparer ==
null)
3370 throw Error.ArgumentNull(
"source");
3372 foreach (TSource item
in source)
3374 if (comparer.
Equals(item, value))
3391 [global::__DynamicallyInvokable]
3396 throw Error.ArgumentNull(
"source");
3400 throw Error.ArgumentNull(
"func");
3406 throw Error.NoElements();
3408 TSource val = enumerator.
Current;
3411 val = func(val, enumerator.
Current);
3426 [global::__DynamicallyInvokable]
3431 throw Error.ArgumentNull(
"source");
3435 throw Error.ArgumentNull(
"func");
3437 TAccumulate val = seed;
3438 foreach (TSource item
in source)
3440 val = func(val, item);
3456 [global::__DynamicallyInvokable]
3461 throw Error.ArgumentNull(
"source");
3465 throw Error.ArgumentNull(
"func");
3467 if (resultSelector ==
null)
3469 throw Error.ArgumentNull(
"resultSelector");
3471 TAccumulate val = seed;
3472 foreach (TSource item
in source)
3474 val = func(val, item);
3476 return resultSelector(val);
3485 [global::__DynamicallyInvokable]
3490 throw Error.ArgumentNull(
"source");
3493 foreach (
int item
in source)
3495 num = checked(num + item);
3506 [global::__DynamicallyInvokable]
3511 throw Error.ArgumentNull(
"source");
3514 foreach (
int? item
in source)
3518 num = checked(num + item.GetValueOrDefault());
3530 [global::__DynamicallyInvokable]
3535 throw Error.ArgumentNull(
"source");
3538 foreach (
long item
in source)
3540 num = checked(num + item);
3551 [global::__DynamicallyInvokable]
3556 throw Error.ArgumentNull(
"source");
3559 foreach (
long? item
in source)
3563 num = checked(num + item.GetValueOrDefault());
3574 [global::__DynamicallyInvokable]
3579 throw Error.ArgumentNull(
"source");
3582 foreach (
float item
in source)
3584 num += (double)item;
3594 [global::__DynamicallyInvokable]
3599 throw Error.ArgumentNull(
"source");
3602 foreach (
float? item
in source)
3606 num += (double)item.GetValueOrDefault();
3617 [global::__DynamicallyInvokable]
3622 throw Error.ArgumentNull(
"source");
3625 foreach (
double item
in source)
3637 [global::__DynamicallyInvokable]
3642 throw Error.ArgumentNull(
"source");
3645 foreach (
double? item
in source)
3649 num += item.GetValueOrDefault();
3661 [global::__DynamicallyInvokable]
3666 throw Error.ArgumentNull(
"source");
3668 decimal num =
default(decimal);
3669 foreach (decimal item
in source)
3682 [global::__DynamicallyInvokable]
3687 throw Error.ArgumentNull(
"source");
3689 decimal num =
default(decimal);
3690 foreach (decimal? item
in source)
3694 num += item.GetValueOrDefault();
3708 [global::__DynamicallyInvokable]
3711 return source.Select(selector).Sum();
3722 [global::__DynamicallyInvokable]
3725 return source.Select(selector).Sum();
3736 [global::__DynamicallyInvokable]
3739 return source.Select(selector).Sum();
3750 [global::__DynamicallyInvokable]
3753 return source.Select(selector).Sum();
3763 [global::__DynamicallyInvokable]
3766 return source.Select(selector).Sum();
3776 [global::__DynamicallyInvokable]
3779 return source.Select(selector).Sum();
3789 [global::__DynamicallyInvokable]
3792 return source.Select(selector).Sum();
3802 [global::__DynamicallyInvokable]
3805 return source.Select(selector).Sum();
3816 [global::__DynamicallyInvokable]
3819 return source.Select(selector).Sum();
3830 [global::__DynamicallyInvokable]
3833 return source.Select(selector).Sum();
3843 [global::__DynamicallyInvokable]
3848 throw Error.ArgumentNull(
"source");
3852 foreach (
int item
in source)
3871 throw Error.NoElements();
3879 [global::__DynamicallyInvokable]
3884 throw Error.ArgumentNull(
"source");
3887 foreach (
int? item
in source)
3889 if (!num.HasValue || item < num)
3904 [global::__DynamicallyInvokable]
3909 throw Error.ArgumentNull(
"source");
3913 foreach (
long item
in source)
3932 throw Error.NoElements();
3940 [global::__DynamicallyInvokable]
3945 throw Error.ArgumentNull(
"source");
3948 foreach (
long? item
in source)
3950 if (!num.HasValue || item < num)
3965 [global::__DynamicallyInvokable]
3970 throw Error.ArgumentNull(
"source");
3974 foreach (
float item
in source)
3978 if (item < num ||
float.IsNaN(item))
3993 throw Error.NoElements();
4001 [global::__DynamicallyInvokable]
4006 throw Error.ArgumentNull(
"source");
4009 foreach (
float? item
in source)
4011 if (item.HasValue && (!num.HasValue || item < num ||
float.IsNaN(item.Value)))
4026 [global::__DynamicallyInvokable]
4031 throw Error.ArgumentNull(
"source");
4035 foreach (
double item
in source)
4039 if (item < num ||
double.IsNaN(item))
4054 throw Error.NoElements();
4062 [global::__DynamicallyInvokable]
4067 throw Error.ArgumentNull(
"source");
4070 foreach (
double? item
in source)
4072 if (item.HasValue && (!num.HasValue || item < num ||
double.IsNaN(item.Value)))
4087 [global::__DynamicallyInvokable]
4092 throw Error.ArgumentNull(
"source");
4094 decimal num =
default(decimal);
4096 foreach (decimal item
in source)
4115 throw Error.NoElements();
4123 [global::__DynamicallyInvokable]
4128 throw Error.ArgumentNull(
"source");
4130 decimal? num =
null;
4131 foreach (decimal? item
in source)
4133 if (!num.HasValue || item < num)
4147 [global::__DynamicallyInvokable]
4152 throw Error.ArgumentNull(
"source");
4155 TSource val =
default(TSource);
4158 foreach (TSource item
in source)
4160 if (item !=
null && (val ==
null || @
default.Compare(item, val) < 0))
4168 foreach (TSource item2
in source)
4172 if (@
default.Compare(item2, val) < 0)
4187 throw Error.NoElements();
4199 [global::__DynamicallyInvokable]
4202 return source.Select(selector).Min();
4212 [global::__DynamicallyInvokable]
4215 return source.Select(selector).Min();
4227 [global::__DynamicallyInvokable]
4230 return source.Select(selector).Min();
4240 [global::__DynamicallyInvokable]
4243 return source.Select(selector).Min();
4255 [global::__DynamicallyInvokable]
4258 return source.Select(selector).Min();
4268 [global::__DynamicallyInvokable]
4271 return source.Select(selector).Min();
4283 [global::__DynamicallyInvokable]
4286 return source.Select(selector).Min();
4296 [global::__DynamicallyInvokable]
4299 return source.Select(selector).Min();
4311 [global::__DynamicallyInvokable]
4314 return source.Select(selector).Min();
4324 [global::__DynamicallyInvokable]
4327 return source.Select(selector).Min();
4338 [global::__DynamicallyInvokable]
4341 return source.Select(selector).Min();
4351 [global::__DynamicallyInvokable]
4356 throw Error.ArgumentNull(
"source");
4360 foreach (
int item
in source)
4379 throw Error.NoElements();
4387 [global::__DynamicallyInvokable]
4392 throw Error.ArgumentNull(
"source");
4395 foreach (
int? item
in source)
4397 if (!num.HasValue || item > num)
4412 [global::__DynamicallyInvokable]
4417 throw Error.ArgumentNull(
"source");
4421 foreach (
long item
in source)
4440 throw Error.NoElements();
4448 [global::__DynamicallyInvokable]
4453 throw Error.ArgumentNull(
"source");
4456 foreach (
long? item
in source)
4458 if (!num.HasValue || item > num)
4473 [global::__DynamicallyInvokable]
4478 throw Error.ArgumentNull(
"source");
4482 foreach (
double item
in source)
4486 if (item > num ||
double.IsNaN(num))
4501 throw Error.NoElements();
4509 [global::__DynamicallyInvokable]
4514 throw Error.ArgumentNull(
"source");
4517 foreach (
double? item
in source)
4519 if (item.HasValue && (!num.HasValue || item > num ||
double.IsNaN(num.Value)))
4534 [global::__DynamicallyInvokable]
4539 throw Error.ArgumentNull(
"source");
4543 foreach (
float item
in source)
4547 if (item > num ||
double.IsNaN(num))
4562 throw Error.NoElements();
4570 [global::__DynamicallyInvokable]
4575 throw Error.ArgumentNull(
"source");
4578 foreach (
float? item
in source)
4580 if (item.HasValue && (!num.HasValue || item > num ||
float.IsNaN(num.Value)))
4595 [global::__DynamicallyInvokable]
4600 throw Error.ArgumentNull(
"source");
4602 decimal num =
default(decimal);
4604 foreach (decimal item
in source)
4623 throw Error.NoElements();
4631 [global::__DynamicallyInvokable]
4636 throw Error.ArgumentNull(
"source");
4638 decimal? num =
null;
4639 foreach (decimal? item
in source)
4641 if (!num.HasValue || item > num)
4655 [global::__DynamicallyInvokable]
4660 throw Error.ArgumentNull(
"source");
4663 TSource val =
default(TSource);
4666 foreach (TSource item
in source)
4668 if (item !=
null && (val ==
null || @
default.Compare(item, val) > 0))
4676 foreach (TSource item2
in source)
4680 if (@
default.Compare(item2, val) > 0)
4695 throw Error.NoElements();
4707 [global::__DynamicallyInvokable]
4710 return source.Select(selector).Max();
4720 [global::__DynamicallyInvokable]
4723 return source.Select(selector).Max();
4735 [global::__DynamicallyInvokable]
4738 return source.Select(selector).Max();
4748 [global::__DynamicallyInvokable]
4751 return source.Select(selector).Max();
4763 [global::__DynamicallyInvokable]
4766 return source.Select(selector).Max();
4776 [global::__DynamicallyInvokable]
4779 return source.Select(selector).Max();
4791 [global::__DynamicallyInvokable]
4794 return source.Select(selector).Max();
4804 [global::__DynamicallyInvokable]
4807 return source.Select(selector).Max();
4819 [global::__DynamicallyInvokable]
4822 return source.Select(selector).Max();
4832 [global::__DynamicallyInvokable]
4835 return source.Select(selector).Max();
4846 [global::__DynamicallyInvokable]
4849 return source.Select(selector).Max();
4859 [global::__DynamicallyInvokable]
4864 throw Error.ArgumentNull(
"source");
4870 foreach (
int item
in source)
4878 return (
double)num / (double)num2;
4880 throw Error.NoElements();
4889 [global::__DynamicallyInvokable]
4894 throw Error.ArgumentNull(
"source");
4900 foreach (
int? item
in source)
4904 num += item.GetValueOrDefault();
4911 return (
double)num / (double)num2;
4923 [global::__DynamicallyInvokable]
4928 throw Error.ArgumentNull(
"source");
4934 foreach (
long item
in source)
4942 return (
double)num / (double)num2;
4944 throw Error.NoElements();
4953 [global::__DynamicallyInvokable]
4958 throw Error.ArgumentNull(
"source");
4964 foreach (
long? item
in source)
4968 num += item.GetValueOrDefault();
4975 return (
double)num / (double)num2;
4987 [global::__DynamicallyInvokable]
4992 throw Error.ArgumentNull(
"source");
4996 foreach (
float item
in source)
4998 num += (double)item;
4999 num2 = checked(num2 + 1);
5003 return (
float)(num / (double)num2);
5005 throw Error.NoElements();
5013 [global::__DynamicallyInvokable]
5018 throw Error.ArgumentNull(
"source");
5022 foreach (
float? item
in source)
5026 num += (double)item.GetValueOrDefault();
5027 num2 = checked(num2 + 1);
5032 return (
float)(num / (double)num2);
5044 [global::__DynamicallyInvokable]
5049 throw Error.ArgumentNull(
"source");
5053 foreach (
double item
in source)
5056 num2 = checked(num2 + 1);
5060 return num / (double)num2;
5062 throw Error.NoElements();
5070 [global::__DynamicallyInvokable]
5075 throw Error.ArgumentNull(
"source");
5079 foreach (
double? item
in source)
5083 num += item.GetValueOrDefault();
5084 num2 = checked(num2 + 1);
5089 return num / (double)num2;
5101 [global::__DynamicallyInvokable]
5106 throw Error.ArgumentNull(
"source");
5108 decimal d =
default(decimal);
5110 foreach (decimal item
in source)
5113 num = checked(num + 1);
5117 return d / (decimal)num;
5119 throw Error.NoElements();
5128 [global::__DynamicallyInvokable]
5133 throw Error.ArgumentNull(
"source");
5135 decimal d =
default(decimal);
5137 foreach (decimal? item
in source)
5141 d += item.GetValueOrDefault();
5142 num = checked(num + 1);
5147 return d / (decimal)num;
5162 [global::__DynamicallyInvokable]
5165 return source.Select(selector).Average();
5176 [global::__DynamicallyInvokable]
5179 return source.Select(selector).Average();
5192 [global::__DynamicallyInvokable]
5195 return source.Select(selector).Average();
5203 [global::__DynamicallyInvokable]
5206 return source.Select(selector).Average();
5218 [global::__DynamicallyInvokable]
5221 return source.Select(selector).Average();
5231 [global::__DynamicallyInvokable]
5234 return source.Select(selector).Average();
5246 [global::__DynamicallyInvokable]
5249 return source.Select(selector).Average();
5259 [global::__DynamicallyInvokable]
5262 return source.Select(selector).Average();
5275 [global::__DynamicallyInvokable]
5278 return source.Select(selector).Average();
5289 [global::__DynamicallyInvokable]
5292 return source.Select(selector).Average();
5306 throw Error.ArgumentNull(
"source");
5308 AppendPrependIterator<TSource> appendPrependIterator = source as AppendPrependIterator<TSource>;
5309 if (appendPrependIterator !=
null)
5311 return appendPrependIterator.Append(element);
5313 return new AppendPrepend1Iterator<TSource>(source, element, appending:
true);
5327 throw Error.ArgumentNull(
"source");
5329 AppendPrependIterator<TSource> appendPrependIterator = source as AppendPrependIterator<TSource>;
5330 if (appendPrependIterator !=
null)
5332 return appendPrependIterator.Prepend(element);
5334 return new AppendPrepend1Iterator<TSource>(source, element, appending:
false);
static Thread CurrentThread
Gets the currently running thread.
static ? long Max(this IEnumerable< long?> source)
Returns the maximum value in a sequence of nullable T:System.Int64 values.
static IEnumerable< TSource > Append< TSource >(this IEnumerable< TSource > source, TSource element)
Appends a value to the end of the sequence.
static TSource [] ToArray< TSource >(this IEnumerable< TSource > source)
Creates an array from a T:System.Collections.Generic.IEnumerable`1.
Compares two objects for equivalence, where string comparisons are case-sensitive.
static IEnumerable< TResult > OfType< TResult >(this IEnumerable source)
Filters the elements of an T:System.Collections.IEnumerable based on a specified type.
static double Average< TSource >(this IEnumerable< TSource > source, Func< TSource, int > selector)
Computes the average of a sequence of T:System.Int32 values that are obtained by invoking a transform...
Provides a base class for implementations of the T:System.Collections.Generic.IEqualityComparer`1 gen...
static int Sum< TSource >(this IEnumerable< TSource > source, Func< TSource, int > selector)
Computes the sum of the sequence of T:System.Int32 values that are obtained by invoking a transform f...
static IEnumerable< int > Range(int start, int count)
Generates a sequence of integral numbers within a specified range.
static TSource SingleOrDefault< TSource >(this IEnumerable< TSource > source)
Returns the only element of a sequence, or a default value if the sequence is empty; this method thro...
void Reset()
Sets the enumerator to its initial position, which is before the first element in the collection.
static IEnumerable< IGrouping< TKey, TElement > > GroupBy< TSource, TKey, TElement >(this IEnumerable< TSource > source, Func< TSource, TKey > keySelector, Func< TSource, TElement > elementSelector)
Groups the elements of a sequence according to a specified key selector function and projects the ele...
bool MoveNext()
Advances the enumerator to the next element of the collection.
static TSource Last< TSource >(this IEnumerable< TSource > source)
Returns the last element of a sequence.
static int Sum(this IEnumerable< int > source)
Computes the sum of a sequence of T:System.Int32 values.
static bool All< TSource >(this IEnumerable< TSource > source, Func< TSource, bool > predicate)
Determines whether all elements of a sequence satisfy a condition.
static IEnumerable< TResult > Select< TSource, TResult >(this IEnumerable< TSource > source, Func< TSource, TResult > selector)
Projects each element of a sequence into a new form.
static IOrderedEnumerable< TSource > ThenBy< TSource, TKey >(this IOrderedEnumerable< TSource > source, Func< TSource, TKey > keySelector)
Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.
static TResult Max< TSource, TResult >(this IEnumerable< TSource > source, Func< TSource, TResult > selector)
Invokes a transform function on each element of a generic sequence and returns the maximum resulting ...
static float Min(this IEnumerable< float > source)
Returns the minimum value in a sequence of T:System.Single values.
static float Sum(this IEnumerable< float > source)
Computes the sum of a sequence of T:System.Single values.
static long Sum(this IEnumerable< long > source)
Computes the sum of a sequence of T:System.Int64 values.
static TSource ElementAtOrDefault< TSource >(this IEnumerable< TSource > source, int index)
Returns the element at a specified index in a sequence or a default value if the index is out of rang...
static ? long Min(this IEnumerable< long?> source)
Returns the minimum value in a sequence of nullable T:System.Int64 values.
Provides a mechanism for releasing unmanaged resources.To browse the .NET Framework source code for t...
static IEnumerable< TSource > Concat< TSource >(this IEnumerable< TSource > first, IEnumerable< TSource > second)
Concatenates two sequences.
static TSource ElementAt< TSource >(this IEnumerable< TSource > source, int index)
Returns the element at a specified index in a sequence.
static TAccumulate Aggregate< TSource, TAccumulate >(this IEnumerable< TSource > source, TAccumulate seed, Func< TAccumulate, TSource, TAccumulate > func)
Applies an accumulator function over a sequence. The specified seed value is used as the initial accu...
static ? double Average(this IEnumerable< long?> source)
Computes the average of a sequence of nullable T:System.Int64 values.
static IEnumerable< TSource > TakeWhile< TSource >(this IEnumerable< TSource > source, Func< TSource, bool > predicate)
Returns elements from a sequence as long as a specified condition is true.
static double Sum(this IEnumerable< double > source)
Computes the sum of a sequence of T:System.Double values.
static TSource Single< TSource >(this IEnumerable< TSource > source)
Returns the only element of a sequence, and throws an exception if there is not exactly one element i...
static List< TSource > ToList< TSource >(this IEnumerable< TSource > source)
Creates a T:System.Collections.Generic.List`1 from an T:System.Collections.Generic....
static IOrderedEnumerable< TSource > OrderBy< TSource, TKey >(this IEnumerable< TSource > source, Func< TSource, TKey > keySelector)
Sorts the elements of a sequence in ascending order according to a key.
static ? float Max(this IEnumerable< float?> source)
Returns the maximum value in a sequence of nullable T:System.Single values.
static ? float Sum(this IEnumerable< float?> source)
Computes the sum of a sequence of nullable T:System.Single values.
static IOrderedEnumerable< TSource > OrderByDescending< TSource, TKey >(this IEnumerable< TSource > source, Func< TSource, TKey > keySelector)
Sorts the elements of a sequence in descending order according to a key.
static ? long Sum(this IEnumerable< long?> source)
Computes the sum of a sequence of nullable T:System.Int64 values.
static IEnumerable< TResult > GroupJoin< TOuter, TInner, TKey, TResult >(this IEnumerable< TOuter > outer, IEnumerable< TInner > inner, Func< TOuter, TKey > outerKeySelector, Func< TInner, TKey > innerKeySelector, Func< TOuter, IEnumerable< TInner >, TResult > resultSelector)
Correlates the elements of two sequences based on equality of keys and groups the results....
static IEnumerable< TResult > GroupBy< TSource, TKey, TResult >(this IEnumerable< TSource > source, Func< TSource, TKey > keySelector, Func< TKey, IEnumerable< TSource >, TResult > resultSelector)
Groups the elements of a sequence according to a specified key selector function and creates a result...
static TSource Max< TSource >(this IEnumerable< TSource > source)
Returns the maximum value in a generic sequence.
static EqualityComparer< T > Default
Returns a default equality comparer for the type specified by the generic argument.
static IEnumerable< TSource > Intersect< TSource >(this IEnumerable< TSource > first, IEnumerable< TSource > second)
Produces the set intersection of two sequences by using the default equality comparer to compare valu...
static IOrderedEnumerable< TSource > ThenByDescending< TSource, TKey >(this IOrderedEnumerable< TSource > source, Func< TSource, TKey > keySelector)
Performs a subsequent ordering of the elements in a sequence in descending order, according to a key.
static long LongCount< TSource >(this IEnumerable< TSource > source)
Returns an T:System.Int64 that represents the total number of elements in a sequence.
static float Average(this IEnumerable< float > source)
Computes the average of a sequence of T:System.Single values.
static ILookup< TKey, TSource > ToLookup< TSource, TKey >(this IEnumerable< TSource > source, Func< TSource, TKey > keySelector)
Creates a T:System.Linq.Lookup`2 from an T:System.Collections.Generic.IEnumerable`1 according to a sp...
static IEnumerable< TSource > Except< TSource >(this IEnumerable< TSource > first, IEnumerable< TSource > second)
Produces the set difference of two sequences by using the default equality comparer to compare values...
static IEnumerable< TSource > Union< TSource >(this IEnumerable< TSource > first, IEnumerable< TSource > second)
Produces the set union of two sequences by using the default equality comparer.
static ? double Min(this IEnumerable< double?> source)
Returns the minimum value in a sequence of nullable T:System.Double values.
static IEnumerable< TSource > Distinct< TSource >(this IEnumerable< TSource > source)
Returns distinct elements from a sequence by using the default equality comparer to compare values.
Exposes an enumerator, which supports a simple iteration over a non-generic collection....
static decimal Min(this IEnumerable< decimal > source)
Returns the minimum value in a sequence of T:System.Decimal values.
new bool Equals(object x, object y)
Determines whether the specified objects are equal.
static ? double Average(this IEnumerable< int?> source)
Computes the average of a sequence of nullable T:System.Int32 values.
static IEnumerable< TResult > Empty< TResult >()
Returns an empty T:System.Collections.Generic.IEnumerable`1 that has the specified type argument.
static Dictionary< TKey, TSource > ToDictionary< TSource, TKey >(this IEnumerable< TSource > source, Func< TSource, TKey > keySelector)
Creates a T:System.Collections.Generic.Dictionary`2 from an T:System.Collections.Generic....
static ? decimal Min(this IEnumerable< decimal?> source)
Returns the minimum value in a sequence of nullable T:System.Decimal values.
Enumerator GetEnumerator()
Returns an enumerator that iterates through the T:System.Collections.Generic.List`1.
static long Min(this IEnumerable< long > source)
Returns the minimum value in a sequence of T:System.Int64 values.
static TSource Aggregate< TSource >(this IEnumerable< TSource > source, Func< TSource, TSource, TSource > func)
Applies an accumulator function over a sequence.
static double Max(this IEnumerable< double > source)
Returns the maximum value in a sequence of T:System.Double values.
static int Max(this IEnumerable< int > source)
Returns the maximum value in a sequence of T:System.Int32 values.
static IEnumerable< TResult > SelectMany< TSource, TResult >(this IEnumerable< TSource > source, Func< TSource, IEnumerable< TResult >> selector)
Projects each element of a sequence to an T:System.Collections.Generic.IEnumerable`1 and flattens the...
static IEnumerable< TResult > Cast< TResult >(this IEnumerable source)
Casts the elements of an T:System.Collections.IEnumerable to the specified type.
static ? float Average(this IEnumerable< float?> source)
Computes the average of a sequence of nullable T:System.Single values.
static readonly Comparer Default
Represents an instance of T:System.Collections.Comparer that is associated with the P:System....
object Current
Gets the element in the collection at the current position of the enumerator.
The Add key (the addition key on the numeric keypad).
static long Max(this IEnumerable< long > source)
Returns the maximum value in a sequence of T:System.Int64 values.
Defines an indexer, size property, and Boolean search method for data structures that map keys to T:S...
Represents a collection of keys each mapped to one or more values.
static TResult Aggregate< TSource, TAccumulate, TResult >(this IEnumerable< TSource > source, TAccumulate seed, Func< TAccumulate, TSource, TAccumulate > func, Func< TAccumulate, TResult > resultSelector)
Applies an accumulator function over a sequence. The specified seed value is used as the initial accu...
Provides a set of static (Shared in Visual Basic) methods for querying objects that implement T:Syste...
IEnumerator GetEnumerator()
Returns an enumerator that iterates through a collection.
static IEnumerable< TResult > SelectMany< TSource, TCollection, TResult >(this IEnumerable< TSource > source, Func< TSource, int, IEnumerable< TCollection >> collectionSelector, Func< TSource, TCollection, TResult > resultSelector)
Projects each element of a sequence to an T:System.Collections.Generic.IEnumerable`1,...
static ? decimal Sum(this IEnumerable< decimal?> source)
Computes the sum of a sequence of nullable T:System.Decimal values.
Represents a collection of keys and values.To browse the .NET Framework source code for this type,...
static ? int Max(this IEnumerable< int?> source)
Returns the maximum value in a sequence of nullable T:System.Int32 values.
static ILookup< TKey, TElement > ToLookup< TSource, TKey, TElement >(this IEnumerable< TSource > source, Func< TSource, TKey > keySelector, Func< TSource, TElement > elementSelector)
Creates a T:System.Linq.Lookup`2 from an T:System.Collections.Generic.IEnumerable`1 according to spec...
static double Average(this IEnumerable< int > source)
Computes the average of a sequence of T:System.Int32 values.
static int Min(this IEnumerable< int > source)
Returns the minimum value in a sequence of T:System.Int32 values.
static double Min(this IEnumerable< double > source)
Returns the minimum value in a sequence of T:System.Double values.
static IEnumerable< TSource > SkipWhile< TSource >(this IEnumerable< TSource > source, Func< TSource, bool > predicate)
Bypasses elements in a sequence as long as a specified condition is true and then returns the remaini...
static TSource LastOrDefault< TSource >(this IEnumerable< TSource > source)
Returns the last element of a sequence, or a default value if the sequence contains no elements.
int ManagedThreadId
Gets a unique identifier for the current managed thread.
static ? decimal Average(this IEnumerable< decimal?> source)
Computes the average of a sequence of nullable T:System.Decimal values.
static IEnumerable< IGrouping< TKey, TSource > > GroupBy< TSource, TKey >(this IEnumerable< TSource > source, Func< TSource, TKey > keySelector)
Groups the elements of a sequence according to a specified key selector function.
static IEnumerable< TSource > Where< TSource >(this IEnumerable< TSource > source, Func< TSource, bool > predicate)
Filters a sequence of values based on a predicate.
static IEnumerable< TSource > Prepend< TSource >(this IEnumerable< TSource > source, TSource element)
Adds a value to the beginning of the sequence.
static IEnumerable< TSource > Reverse< TSource >(this IEnumerable< TSource > source)
Inverts the order of the elements in a sequence.
static Dictionary< TKey, TElement > ToDictionary< TSource, TKey, TElement >(this IEnumerable< TSource > source, Func< TSource, TKey > keySelector, Func< TSource, TElement > elementSelector)
Creates a T:System.Collections.Generic.Dictionary`2 from an T:System.Collections.Generic....
static TResult Min< TSource, TResult >(this IEnumerable< TSource > source, Func< TSource, TResult > selector)
Invokes a transform function on each element of a generic sequence and returns the minimum resulting ...
static ? float Min(this IEnumerable< float?> source)
Returns the minimum value in a sequence of nullable T:System.Single values.
static ? int Min(this IEnumerable< int?> source)
Returns the minimum value in a sequence of nullable T:System.Int32 values.
static ? double Max(this IEnumerable< double?> source)
Returns the maximum value in a sequence of nullable T:System.Double values.
static TSource First< TSource >(this IEnumerable< TSource > source)
Returns the first element of a sequence.
static ? double Sum(this IEnumerable< double?> source)
Computes the sum of a sequence of nullable T:System.Double values.
static IEnumerable< TSource > Take< TSource >(this IEnumerable< TSource > source, int count)
Returns a specified number of contiguous elements from the start of a sequence.
static float Max(this IEnumerable< float > source)
Returns the maximum value in a sequence of T:System.Single values.
static IEnumerable< TResult > Join< TOuter, TInner, TKey, TResult >(this IEnumerable< TOuter > outer, IEnumerable< TInner > inner, Func< TOuter, TKey > outerKeySelector, Func< TInner, TKey > innerKeySelector, Func< TOuter, TInner, TResult > resultSelector)
Correlates the elements of two sequences based on matching keys. The default equality comparer is use...
static IEnumerable< TResult > GroupBy< TSource, TKey, TElement, TResult >(this IEnumerable< TSource > source, Func< TSource, TKey > keySelector, Func< TSource, TElement > elementSelector, Func< TKey, IEnumerable< TElement >, TResult > resultSelector)
Groups the elements of a sequence according to a specified key selector function and creates a result...
static ? decimal Max(this IEnumerable< decimal?> source)
Returns the maximum value in a sequence of nullable T:System.Decimal values.
static IEnumerable< TSource > Skip< TSource >(this IEnumerable< TSource > source, int count)
Bypasses a specified number of elements in a sequence and then returns the remaining elements.
int Count
Gets the number of elements contained in the T:System.Collections.ICollection.
static decimal Max(this IEnumerable< decimal > source)
Returns the maximum value in a sequence of T:System.Decimal values.
static TSource Min< TSource >(this IEnumerable< TSource > source)
Returns the minimum value in a generic sequence.
static decimal Sum(this IEnumerable< decimal > source)
Computes the sum of a sequence of T:System.Decimal values.
Defines size, enumerators, and synchronization methods for all nongeneric collections.
static ? double Average(this IEnumerable< double?> source)
Computes the average of a sequence of nullable T:System.Double values.
static int Count< TSource >(this IEnumerable< TSource > source)
Returns the number of elements in a sequence.
static bool SequenceEqual< TSource >(this IEnumerable< TSource > first, IEnumerable< TSource > second)
Determines whether two sequences are equal by comparing the elements by using the default equality co...
static IEnumerable< TResult > Repeat< TResult >(TResult element, int count)
Generates a sequence that contains one repeated value.
static IEnumerable< TSource > AsEnumerable< TSource >(this IEnumerable< TSource > source)
Returns the input typed as T:System.Collections.Generic.IEnumerable`1.
static double Average(this IEnumerable< long > source)
Computes the average of a sequence of T:System.Int64 values.
The exception that is thrown when a requested method or operation is not implemented.
Supports a simple iteration over a non-generic collection.
static double Average(this IEnumerable< double > source)
Computes the average of a sequence of T:System.Double values.
static TSource FirstOrDefault< TSource >(this IEnumerable< TSource > source)
Returns the first element of a sequence, or a default value if the sequence contains no elements.
static bool Any< TSource >(this IEnumerable< TSource > source)
Determines whether a sequence contains any elements.
static IEnumerable< TResult > Zip< TFirst, TSecond, TResult >(this IEnumerable< TFirst > first, IEnumerable< TSecond > second, Func< TFirst, TSecond, TResult > resultSelector)
Applies a specified function to the corresponding elements of two sequences, producing a sequence of ...
static bool Contains< TSource >(this IEnumerable< TSource > source, TSource value)
Determines whether a sequence contains a specified element by using the default equality comparer.
static IEnumerable< TSource > DefaultIfEmpty< TSource >(this IEnumerable< TSource > source)
Returns the elements of the specified sequence or the type parameter's default value in a singleton c...
static ? int Sum(this IEnumerable< int?> source)
Computes the sum of a sequence of nullable T:System.Int32 values.
static decimal Average(this IEnumerable< decimal > source)
Computes the average of a sequence of T:System.Decimal values.
Creates and controls a thread, sets its priority, and gets its status.