using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; namespace System.Linq { /// Provides a set of static (Shared in Visual Basic) methods for querying objects that implement . // Token: 0x02000032 RID: 50 public static class Enumerable { /// Applies an accumulator function over a sequence. /// The final accumulator value. /// An to aggregate over. /// An accumulator function to be invoked on each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. // Token: 0x0600027B RID: 635 RVA: 0x0000CE3C File Offset: 0x0000B03C public static TSource Aggregate(this IEnumerable source, Func func) { Check.SourceAndFunc(source, func); TSource tsource3; using (IEnumerator enumerator = source.GetEnumerator()) { if (!enumerator.MoveNext()) { throw new InvalidOperationException("No elements in source list"); } TSource tsource = enumerator.Current; while (enumerator.MoveNext()) { TSource tsource2 = enumerator.Current; tsource = func(tsource, tsource2); } tsource3 = tsource; } return tsource3; } /// Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value. /// The final accumulator value. /// An to aggregate over. /// The initial accumulator value. /// An accumulator function to be invoked on each element. /// The type of the elements of . /// The type of the accumulator value. /// /// or is null. // Token: 0x0600027C RID: 636 RVA: 0x0000CEC8 File Offset: 0x0000B0C8 public static TAccumulate Aggregate(this IEnumerable source, TAccumulate seed, Func func) { Check.SourceAndFunc(source, func); TAccumulate taccumulate = seed; foreach (TSource tsource in source) { taccumulate = func(taccumulate, tsource); } return taccumulate; } /// Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value. /// The transformed final accumulator value. /// An to aggregate over. /// The initial accumulator value. /// An accumulator function to be invoked on each element. /// A function to transform the final accumulator value into the result value. /// The type of the elements of . /// The type of the accumulator value. /// The type of the resulting value. /// /// or or is null. // Token: 0x0600027D RID: 637 RVA: 0x0000CF34 File Offset: 0x0000B134 public static TResult Aggregate(this IEnumerable source, TAccumulate seed, Func func, Func resultSelector) { Check.SourceAndFunc(source, func); if (resultSelector == null) { throw new ArgumentNullException("resultSelector"); } TAccumulate taccumulate = seed; foreach (TSource tsource in source) { taccumulate = func(taccumulate, tsource); } return resultSelector(taccumulate); } /// Determines whether all elements of a sequence satisfy a condition. /// true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false. /// An that contains the elements to apply the predicate to. /// A function to test each element for a condition. /// The type of the elements of . /// /// or is null. // Token: 0x0600027E RID: 638 RVA: 0x0000CFB8 File Offset: 0x0000B1B8 public static bool All(this IEnumerable source, Func predicate) { Check.SourceAndPredicate(source, predicate); foreach (TSource tsource in source) { if (!predicate(tsource)) { return false; } } return true; } /// Determines whether a sequence contains any elements. /// true if the source sequence contains any elements; otherwise, false. /// The to check for emptiness. /// The type of the elements of . /// /// is null. // Token: 0x0600027F RID: 639 RVA: 0x0000D02C File Offset: 0x0000B22C public static bool Any(this IEnumerable source) { Check.Source(source); ICollection collection = source as ICollection; if (collection != null) { return collection.Count > 0; } bool flag; using (IEnumerator enumerator = source.GetEnumerator()) { flag = enumerator.MoveNext(); } return flag; } /// Determines whether any element of a sequence satisfies a condition. /// true if any elements in the source sequence pass the test in the specified predicate; otherwise, false. /// An whose elements to apply the predicate to. /// A function to test each element for a condition. /// The type of the elements of . /// /// or is null. // Token: 0x06000280 RID: 640 RVA: 0x0000D098 File Offset: 0x0000B298 public static bool Any(this IEnumerable source, Func predicate) { Check.SourceAndPredicate(source, predicate); foreach (TSource tsource in source) { if (predicate(tsource)) { return true; } } return false; } /// Returns the input typed as . /// The input sequence typed as . /// The sequence to type as . /// The type of the elements of . // Token: 0x06000281 RID: 641 RVA: 0x0000D10C File Offset: 0x0000B30C public static IEnumerable AsEnumerable(this IEnumerable source) { return source; } /// Computes the average of a sequence of values. /// The average of the sequence of values. /// A sequence of values to calculate the average of. /// /// is null. /// /// contains no elements. /// The sum of the elements in the sequence is larger than . // Token: 0x06000282 RID: 642 RVA: 0x0000D110 File Offset: 0x0000B310 public static double Average(this IEnumerable source) { Check.Source(source); long num = 0L; int num2 = 0; foreach (int num3 in source) { checked { num += unchecked((long)num3); } num2++; } if (num2 == 0) { throw new InvalidOperationException(); } return (double)num / (double)num2; } /// Computes the average of a sequence of values. /// The average of the sequence of values. /// A sequence of values to calculate the average of. /// /// is null. /// /// contains no elements. /// The sum of the elements in the sequence is larger than . // Token: 0x06000283 RID: 643 RVA: 0x0000D18C File Offset: 0x0000B38C public static double Average(this IEnumerable source) { Check.Source(source); long num = 0L; long num2 = 0L; foreach (long num3 in source) { num += num3; num2 += 1L; } if (num2 == 0L) { throw new InvalidOperationException(); } return (double)num / (double)num2; } /// Computes the average of a sequence of values. /// The average of the sequence of values. /// A sequence of values to calculate the average of. /// /// is null. /// /// contains no elements. // Token: 0x06000284 RID: 644 RVA: 0x0000D20C File Offset: 0x0000B40C public static double Average(this IEnumerable source) { Check.Source(source); double num = 0.0; long num2 = 0L; foreach (double num3 in source) { double num4 = num3; num += num4; num2 += 1L; } if (num2 == 0L) { throw new InvalidOperationException(); } return num / (double)num2; } /// Computes the average of a sequence of values. /// The average of the sequence of values. /// A sequence of values to calculate the average of. /// /// is null. /// /// contains no elements. // Token: 0x06000285 RID: 645 RVA: 0x0000D290 File Offset: 0x0000B490 public static float Average(this IEnumerable source) { Check.Source(source); float num = 0f; long num2 = 0L; foreach (float num3 in source) { float num4 = num3; num += num4; num2 += 1L; } if (num2 == 0L) { throw new InvalidOperationException(); } return num / (float)num2; } /// Computes the average of a sequence of values. /// The average of the sequence of values. /// A sequence of values to calculate the average of. /// /// is null. /// /// contains no elements. /// The sum of the elements in the sequence is larger than . // Token: 0x06000286 RID: 646 RVA: 0x0000D310 File Offset: 0x0000B510 public static decimal Average(this IEnumerable source) { Check.Source(source); decimal num = 0m; long num2 = 0L; foreach (decimal num3 in source) { num += num3; num2 += 1L; } if (num2 == 0L) { throw new InvalidOperationException(); } return num / num2; } /// Computes the average of a sequence of nullable values. /// The average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// A sequence of nullable values to calculate the average of. /// /// is null. /// The sum of the elements in the sequence is larger than . // Token: 0x06000287 RID: 647 RVA: 0x0000D39C File Offset: 0x0000B59C public static double? Average(this IEnumerable source) { Check.Source(source); long num = 0L; long num2 = 0L; foreach (int? num3 in source) { if (num3 != null) { num += (long)num3.Value; num2 += 1L; } } if (num2 == 0L) { return null; } return new double?((double)num / (double)num2); } /// Computes the average of a sequence of nullable values. /// The average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// A sequence of nullable values to calculate the average of. /// /// is null. /// The sum of the elements in the sequence is larger than . // Token: 0x06000288 RID: 648 RVA: 0x0000D43C File Offset: 0x0000B63C public static double? Average(this IEnumerable source) { Check.Source(source); long num = 0L; long num2 = 0L; foreach (long? num3 in source) { if (num3 != null) { checked { num += num3.Value; } num2 += 1L; } } if (num2 == 0L) { return null; } return new double?((double)num / (double)num2); } /// Computes the average of a sequence of nullable values. /// The average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// A sequence of nullable values to calculate the average of. /// /// is null. // Token: 0x06000289 RID: 649 RVA: 0x0000D4DC File Offset: 0x0000B6DC public static double? Average(this IEnumerable source) { Check.Source(source); double num = 0.0; long num2 = 0L; foreach (double? num3 in source) { if (num3 != null) { num += num3.Value; num2 += 1L; } } if (num2 == 0L) { return null; } return new double?(num / (double)num2); } /// Computes the average of a sequence of nullable values. /// The average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// A sequence of nullable values to calculate the average of. /// /// is null. /// The sum of the elements in the sequence is larger than . // Token: 0x0600028A RID: 650 RVA: 0x0000D580 File Offset: 0x0000B780 public static decimal? Average(this IEnumerable source) { Check.Source(source); decimal num = 0m; long num2 = 0L; foreach (decimal? num3 in source) { if (num3 != null) { num += num3.Value; num2 += 1L; } } if (num2 == 0L) { return null; } return new decimal?(num / num2); } /// Computes the average of a sequence of nullable values. /// The average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// A sequence of nullable values to calculate the average of. /// /// is null. // Token: 0x0600028B RID: 651 RVA: 0x0000D630 File Offset: 0x0000B830 public static float? Average(this IEnumerable source) { Check.Source(source); float num = 0f; long num2 = 0L; foreach (float? num3 in source) { if (num3 != null) { num += num3.Value; num2 += 1L; } } if (num2 == 0L) { return null; } return new float?(num / (float)num2); } /// Computes the average of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// The average of the sequence of values. /// A sequence of values to calculate the average of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. /// The sum of the elements in the sequence is larger than . // Token: 0x0600028C RID: 652 RVA: 0x0000D6D0 File Offset: 0x0000B8D0 public static double Average(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); long num = 0L; long num2 = 0L; foreach (TSource tsource in source) { num += (long)selector(tsource); num2 += 1L; } if (num2 == 0L) { throw new InvalidOperationException(); } return (double)num / (double)num2; } /// Computes the average of a sequence of nullable values that are obtained by invoking a transform function on each element of the input sequence. /// The average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// A sequence of values to calculate the average of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// The sum of the elements in the sequence is larger than . // Token: 0x0600028D RID: 653 RVA: 0x0000D758 File Offset: 0x0000B958 public static double? Average(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); long num = 0L; long num2 = 0L; foreach (TSource tsource in source) { int? num3 = selector(tsource); if (num3 != null) { num += (long)num3.Value; num2 += 1L; } } if (num2 == 0L) { return null; } return new double?((double)num / (double)num2); } /// Computes the average of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// The average of the sequence of values. /// A sequence of values to calculate the average of. /// A transform function to apply to each element. /// The type of the elements of source. /// /// or is null. /// /// contains no elements. /// The sum of the elements in the sequence is larger than . // Token: 0x0600028E RID: 654 RVA: 0x0000D804 File Offset: 0x0000BA04 public static double Average(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); long num = 0L; long num2 = 0L; foreach (TSource tsource in source) { checked { num += selector(tsource); } num2 += 1L; } if (num2 == 0L) { throw new InvalidOperationException(); } return (double)num / (double)num2; } /// Computes the average of a sequence of nullable values that are obtained by invoking a transform function on each element of the input sequence. /// The average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// A sequence of values to calculate the average of. /// A transform function to apply to each element. /// The type of the elements of . // Token: 0x0600028F RID: 655 RVA: 0x0000D888 File Offset: 0x0000BA88 public static double? Average(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); long num = 0L; long num2 = 0L; foreach (TSource tsource in source) { long? num3 = selector(tsource); if (num3 != null) { checked { num += num3.Value; } num2 += 1L; } } if (num2 == 0L) { return null; } return new double?((double)num / (double)num2); } /// Computes the average of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// The average of the sequence of values. /// A sequence of values to calculate the average of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. // Token: 0x06000290 RID: 656 RVA: 0x0000D930 File Offset: 0x0000BB30 public static double Average(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); double num = 0.0; long num2 = 0L; foreach (TSource tsource in source) { num += selector(tsource); num2 += 1L; } if (num2 == 0L) { throw new InvalidOperationException(); } return num / (double)num2; } /// Computes the average of a sequence of nullable values that are obtained by invoking a transform function on each element of the input sequence. /// The average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// A sequence of values to calculate the average of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x06000291 RID: 657 RVA: 0x0000D9BC File Offset: 0x0000BBBC public static double? Average(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); double num = 0.0; long num2 = 0L; foreach (TSource tsource in source) { double? num3 = selector(tsource); if (num3 != null) { num += num3.Value; num2 += 1L; } } if (num2 == 0L) { return null; } return new double?(num / (double)num2); } /// Computes the average of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// The average of the sequence of values. /// A sequence of values to calculate the average of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. // Token: 0x06000292 RID: 658 RVA: 0x0000DA6C File Offset: 0x0000BC6C public static float Average(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); float num = 0f; long num2 = 0L; foreach (TSource tsource in source) { num += selector(tsource); num2 += 1L; } if (num2 == 0L) { throw new InvalidOperationException(); } return num / (float)num2; } /// Computes the average of a sequence of nullable values that are obtained by invoking a transform function on each element of the input sequence. /// The average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// A sequence of values to calculate the average of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x06000293 RID: 659 RVA: 0x0000DAF4 File Offset: 0x0000BCF4 public static float? Average(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); float num = 0f; long num2 = 0L; foreach (TSource tsource in source) { float? num3 = selector(tsource); if (num3 != null) { num += num3.Value; num2 += 1L; } } if (num2 == 0L) { return null; } return new float?(num / (float)num2); } /// Computes the average of a sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// The average of the sequence of values. /// A sequence of values that are used to calculate an average. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. /// The sum of the elements in the sequence is larger than . // Token: 0x06000294 RID: 660 RVA: 0x0000DBA0 File Offset: 0x0000BDA0 public static decimal Average(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); decimal num = 0m; long num2 = 0L; foreach (TSource tsource in source) { num += selector(tsource); num2 += 1L; } if (num2 == 0L) { throw new InvalidOperationException(); } return num / num2; } /// Computes the average of a sequence of nullable values that are obtained by invoking a transform function on each element of the input sequence. /// The average of the sequence of values, or null if the source sequence is empty or contains only values that are null. /// A sequence of values to calculate the average of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// The sum of the elements in the sequence is larger than . // Token: 0x06000295 RID: 661 RVA: 0x0000DC34 File Offset: 0x0000BE34 public static decimal? Average(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); decimal num = 0m; long num2 = 0L; foreach (TSource tsource in source) { decimal? num3 = selector(tsource); if (num3 != null) { num += num3.Value; num2 += 1L; } } if (num2 == 0L) { return null; } return new decimal?(num / num2); } /// Converts the elements of an to the specified type. /// An that contains each element of the source sequence converted to the specified type. /// The that contains the elements to be converted. /// The type to convert the elements of to. /// /// is null. /// An element in the sequence cannot be cast to type . // Token: 0x06000296 RID: 662 RVA: 0x0000DCEC File Offset: 0x0000BEEC public static IEnumerable Cast(this IEnumerable source) { Check.Source(source); IEnumerable enumerable = source as IEnumerable; if (enumerable != null) { return enumerable; } return Enumerable.CreateCastIterator(source); } // Token: 0x06000297 RID: 663 RVA: 0x0000DD14 File Offset: 0x0000BF14 private static IEnumerable CreateCastIterator(IEnumerable source) { foreach (object obj in source) { TResult element = (TResult)((object)obj); yield return element; } yield break; } /// Concatenates two sequences. /// An that contains the concatenated elements of the two input sequences. /// The first sequence to concatenate. /// The sequence to concatenate to the first sequence. /// The type of the elements of the input sequences. /// /// or is null. // Token: 0x06000298 RID: 664 RVA: 0x0000DD40 File Offset: 0x0000BF40 public static IEnumerable Concat(this IEnumerable first, IEnumerable second) { Check.FirstAndSecond(first, second); return Enumerable.CreateConcatIterator(first, second); } // Token: 0x06000299 RID: 665 RVA: 0x0000DD50 File Offset: 0x0000BF50 private static IEnumerable CreateConcatIterator(IEnumerable first, IEnumerable second) { foreach (TSource element in first) { yield return element; } foreach (TSource element2 in second) { yield return element2; } yield break; } /// Determines whether a sequence contains a specified element by using the default equality comparer. /// true if the source sequence contains an element that has the specified value; otherwise, false. /// A sequence in which to locate a value. /// The value to locate in the sequence. /// The type of the elements of . /// /// is null. // Token: 0x0600029A RID: 666 RVA: 0x0000DD88 File Offset: 0x0000BF88 public static bool Contains(this IEnumerable source, TSource value) { ICollection collection = source as ICollection; if (collection != null) { return collection.Contains(value); } return source.Contains(value, null); } /// Determines whether a sequence contains a specified element by using a specified . /// true if the source sequence contains an element that has the specified value; otherwise, false. /// A sequence in which to locate a value. /// The value to locate in the sequence. /// An equality comparer to compare values. /// The type of the elements of . /// /// is null. // Token: 0x0600029B RID: 667 RVA: 0x0000DDB4 File Offset: 0x0000BFB4 public static bool Contains(this IEnumerable source, TSource value, IEqualityComparer comparer) { Check.Source(source); if (comparer == null) { comparer = EqualityComparer.Default; } foreach (TSource tsource in source) { if (comparer.Equals(tsource, value)) { return true; } } return false; } /// Returns the number of elements in a sequence. /// The number of elements in the input sequence. /// A sequence that contains elements to be counted. /// The type of the elements of . /// /// is null. /// The number of elements in is larger than . // Token: 0x0600029C RID: 668 RVA: 0x0000DE38 File Offset: 0x0000C038 public static int Count(this IEnumerable source) { Check.Source(source); ICollection collection = source as ICollection; if (collection != null) { return collection.Count; } int num = 0; using (IEnumerator enumerator = source.GetEnumerator()) { while (enumerator.MoveNext()) { num++; } } return num; } /// Returns a number that represents how many elements in the specified sequence satisfy a condition. /// A number that represents how many elements in the sequence satisfy the condition in the predicate function. /// A sequence that contains elements to be tested and counted. /// A function to test each element for a condition. /// The type of the elements of . /// /// or is null. /// The number of elements in is larger than . // Token: 0x0600029D RID: 669 RVA: 0x0000DEAC File Offset: 0x0000C0AC public static int Count(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); int num = 0; foreach (TSource tsource in source) { if (selector(tsource)) { num++; } } return num; } /// Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty. /// An object that contains the default value for the type if is empty; otherwise, . /// The sequence to return a default value for if it is empty. /// The type of the elements of . /// /// is null. // Token: 0x0600029E RID: 670 RVA: 0x0000DF20 File Offset: 0x0000C120 public static IEnumerable DefaultIfEmpty(this IEnumerable source) { return source.DefaultIfEmpty(default(TSource)); } /// Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty. /// An that contains if is empty; otherwise, . /// The sequence to return the specified value for if it is empty. /// The value to return if the sequence is empty. /// The type of the elements of . // Token: 0x0600029F RID: 671 RVA: 0x0000DF3C File Offset: 0x0000C13C public static IEnumerable DefaultIfEmpty(this IEnumerable source, TSource defaultValue) { Check.Source(source); return Enumerable.CreateDefaultIfEmptyIterator(source, defaultValue); } // Token: 0x060002A0 RID: 672 RVA: 0x0000DF4C File Offset: 0x0000C14C private static IEnumerable CreateDefaultIfEmptyIterator(IEnumerable source, TSource defaultValue) { bool empty = true; foreach (TSource item in source) { empty = false; yield return item; } if (empty) { yield return defaultValue; } yield break; } /// Returns distinct elements from a sequence by using the default equality comparer to compare values. /// An that contains distinct elements from the source sequence. /// The sequence to remove duplicate elements from. /// The type of the elements of . /// /// is null. // Token: 0x060002A1 RID: 673 RVA: 0x0000DF84 File Offset: 0x0000C184 public static IEnumerable Distinct(this IEnumerable source) { return source.Distinct(null); } /// Returns distinct elements from a sequence by using a specified to compare values. /// An that contains distinct elements from the source sequence. /// The sequence to remove duplicate elements from. /// An to compare values. /// The type of the elements of . /// /// is null. // Token: 0x060002A2 RID: 674 RVA: 0x0000DF90 File Offset: 0x0000C190 public static IEnumerable Distinct(this IEnumerable source, IEqualityComparer comparer) { Check.Source(source); if (comparer == null) { comparer = EqualityComparer.Default; } return Enumerable.CreateDistinctIterator(source, comparer); } // Token: 0x060002A3 RID: 675 RVA: 0x0000DFAC File Offset: 0x0000C1AC private static IEnumerable CreateDistinctIterator(IEnumerable source, IEqualityComparer comparer) { HashSet items = new HashSet(comparer); foreach (TSource element in source) { if (!items.Contains(element)) { items.Add(element); yield return element; } } yield break; } // Token: 0x060002A4 RID: 676 RVA: 0x0000DFE4 File Offset: 0x0000C1E4 private static TSource ElementAt(this IEnumerable source, int index, Enumerable.Fallback fallback) { long num = 0L; foreach (TSource tsource in source) { long num2 = (long)index; long num3 = num; num = num3 + 1L; if (num2 == num3) { return tsource; } } if (fallback == Enumerable.Fallback.Throw) { throw new ArgumentOutOfRangeException(); } return default(TSource); } /// Returns the element at a specified index in a sequence. /// The element at the specified position in the source sequence. /// An to return an element from. /// The zero-based index of the element to retrieve. /// The type of the elements of . /// /// is null. /// /// is less than 0 or greater than or equal to the number of elements in . // Token: 0x060002A5 RID: 677 RVA: 0x0000E06C File Offset: 0x0000C26C public static TSource ElementAt(this IEnumerable source, int index) { Check.Source(source); if (index < 0) { throw new ArgumentOutOfRangeException(); } IList list = source as IList; if (list != null) { return list[index]; } return source.ElementAt(index, Enumerable.Fallback.Throw); } /// Returns the element at a specified index in a sequence or a default value if the index is out of range. /// default() if the index is outside the bounds of the source sequence; otherwise, the element at the specified position in the source sequence. /// An to return an element from. /// The zero-based index of the element to retrieve. /// The type of the elements of . /// /// is null. // Token: 0x060002A6 RID: 678 RVA: 0x0000E0AC File Offset: 0x0000C2AC public static TSource ElementAtOrDefault(this IEnumerable source, int index) { Check.Source(source); if (index < 0) { return default(TSource); } IList list = source as IList; if (list != null) { return (index >= list.Count) ? default(TSource) : list[index]; } return source.ElementAt(index, Enumerable.Fallback.Default); } /// Returns an empty that has the specified type argument. /// An empty whose type argument is . /// The type to assign to the type parameter of the returned generic . // Token: 0x060002A7 RID: 679 RVA: 0x0000E108 File Offset: 0x0000C308 public static IEnumerable Empty() { return new TResult[0]; } /// Produces the set difference of two sequences by using the default equality comparer to compare values. /// A sequence that contains the set difference of the elements of two sequences. /// An whose elements that are not also in will be returned. /// An whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence. /// The type of the elements of the input sequences. /// /// or is null. // Token: 0x060002A8 RID: 680 RVA: 0x0000E110 File Offset: 0x0000C310 public static IEnumerable Except(this IEnumerable first, IEnumerable second) { return first.Except(second, null); } /// Produces the set difference of two sequences by using the specified to compare values. /// A sequence that contains the set difference of the elements of two sequences. /// An whose elements that are not also in will be returned. /// An whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence. /// An to compare values. /// The type of the elements of the input sequences. /// /// or is null. // Token: 0x060002A9 RID: 681 RVA: 0x0000E11C File Offset: 0x0000C31C public static IEnumerable Except(this IEnumerable first, IEnumerable second, IEqualityComparer comparer) { Check.FirstAndSecond(first, second); if (comparer == null) { comparer = EqualityComparer.Default; } return Enumerable.CreateExceptIterator(first, second, comparer); } // Token: 0x060002AA RID: 682 RVA: 0x0000E13C File Offset: 0x0000C33C private static IEnumerable CreateExceptIterator(IEnumerable first, IEnumerable second, IEqualityComparer comparer) { HashSet items = new HashSet(second, comparer); foreach (TSource element in first) { if (!items.Contains(element, comparer)) { yield return element; } } yield break; } // Token: 0x060002AB RID: 683 RVA: 0x0000E184 File Offset: 0x0000C384 private static TSource First(this IEnumerable source, Func predicate, Enumerable.Fallback fallback) { foreach (TSource tsource in source) { if (predicate(tsource)) { return tsource; } } if (fallback == Enumerable.Fallback.Throw) { throw new InvalidOperationException(); } return default(TSource); } /// Returns the first element of a sequence. /// The first element in the specified sequence. /// The to return the first element of. /// The type of the elements of . /// /// is null. /// The source sequence is empty. // Token: 0x060002AC RID: 684 RVA: 0x0000E208 File Offset: 0x0000C408 public static TSource First(this IEnumerable source) { Check.Source(source); IList list = source as IList; if (list == null) { using (IEnumerator enumerator = source.GetEnumerator()) { if (enumerator.MoveNext()) { return enumerator.Current; } } throw new InvalidOperationException(); } if (list.Count != 0) { return list[0]; } throw new InvalidOperationException(); } /// Returns the first element in a sequence that satisfies a specified condition. /// The first element in the sequence that passes the test in the specified predicate function. /// An to return an element from. /// A function to test each element for a condition. /// The type of the elements of . /// /// or is null. /// No element satisfies the condition in .-or-The source sequence is empty. // Token: 0x060002AD RID: 685 RVA: 0x0000E294 File Offset: 0x0000C494 public static TSource First(this IEnumerable source, Func predicate) { Check.SourceAndPredicate(source, predicate); return source.First(predicate, Enumerable.Fallback.Throw); } /// Returns the first element of a sequence, or a default value if the sequence contains no elements. /// default() if is empty; otherwise, the first element in . /// The to return the first element of. /// The type of the elements of . /// /// is null. // Token: 0x060002AE RID: 686 RVA: 0x0000E2A8 File Offset: 0x0000C4A8 public static TSource FirstOrDefault(this IEnumerable source) { Check.Source(source); using (IEnumerator enumerator = source.GetEnumerator()) { if (enumerator.MoveNext()) { return enumerator.Current; } } return default(TSource); } /// Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. /// default() if is empty or if no element passes the test specified by ; otherwise, the first element in that passes the test specified by . /// An to return an element from. /// A function to test each element for a condition. /// The type of the elements of . /// /// or is null. // Token: 0x060002AF RID: 687 RVA: 0x0000E318 File Offset: 0x0000C518 public static TSource FirstOrDefault(this IEnumerable source, Func predicate) { Check.SourceAndPredicate(source, predicate); return source.First(predicate, Enumerable.Fallback.Default); } // Token: 0x060002B0 RID: 688 RVA: 0x0000E32C File Offset: 0x0000C52C private static List ContainsGroup(Dictionary> items, K key, IEqualityComparer comparer) { IEqualityComparer equalityComparer = comparer ?? EqualityComparer.Default; foreach (KeyValuePair> keyValuePair in items) { if (equalityComparer.Equals(keyValuePair.Key, key)) { return keyValuePair.Value; } } return null; } /// Groups the elements of a sequence according to a specified key selector function. /// An IEnumerable<IGrouping<TKey, TSource>> in C# or IEnumerable(Of IGrouping(Of TKey, TSource)) in Visual Basic where each object contains a sequence of objects and a key. /// An whose elements to group. /// A function to extract the key for each element. /// The type of the elements of . /// The type of the key returned by . /// /// or is null. // Token: 0x060002B1 RID: 689 RVA: 0x0000E3B8 File Offset: 0x0000C5B8 public static IEnumerable> GroupBy(this IEnumerable source, Func keySelector) { return source.GroupBy(keySelector, null); } /// Groups the elements of a sequence according to a specified key selector function and compares the keys by using a specified comparer. /// An IEnumerable<IGrouping<TKey, TSource>> in C# or IEnumerable(Of IGrouping(Of TKey, TSource)) in Visual Basic where each object contains a collection of objects and a key. /// An whose elements to group. /// A function to extract the key for each element. /// An to compare keys. /// The type of the elements of . /// The type of the key returned by . /// /// or is null. // Token: 0x060002B2 RID: 690 RVA: 0x0000E3C4 File Offset: 0x0000C5C4 public static IEnumerable> GroupBy(this IEnumerable source, Func keySelector, IEqualityComparer comparer) { Check.SourceAndKeySelector(source, keySelector); return source.CreateGroupByIterator(keySelector, comparer); } // Token: 0x060002B3 RID: 691 RVA: 0x0000E3D8 File Offset: 0x0000C5D8 private static IEnumerable> CreateGroupByIterator(this IEnumerable source, Func keySelector, IEqualityComparer comparer) { Dictionary> groups = new Dictionary>(); List nullList = new List(); int counter = 0; int nullCounter = -1; foreach (TSource element in source) { TKey key = keySelector(element); if (key == null) { nullList.Add(element); if (nullCounter == -1) { nullCounter = counter; counter++; } } else { List group = Enumerable.ContainsGroup(groups, key, comparer); if (group == null) { group = new List(); groups.Add(key, group); counter++; } group.Add(element); } } counter = 0; foreach (KeyValuePair> group2 in groups) { if (counter == nullCounter) { yield return new Grouping(default(TKey), nullList); counter++; } yield return new Grouping(group2.Key, group2.Value); counter++; } if (counter == nullCounter) { yield return new Grouping(default(TKey), nullList); counter++; } yield break; } /// Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function. /// An IEnumerable<IGrouping<TKey, TElement>> in C# or IEnumerable(Of IGrouping(Of TKey, TElement)) in Visual Basic where each object contains a collection of objects of type  and a key. /// An whose elements to group. /// A function to extract the key for each element. /// A function to map each source element to an element in the . /// The type of the elements of . /// The type of the key returned by . /// The type of the elements in the . /// /// or or is null. // Token: 0x060002B4 RID: 692 RVA: 0x0000E420 File Offset: 0x0000C620 public static IEnumerable> GroupBy(this IEnumerable source, Func keySelector, Func elementSelector) { return source.GroupBy(keySelector, elementSelector, null); } /// Groups the elements of a sequence according to a key selector function. The keys are compared by using a comparer and each group's elements are projected by using a specified function. /// An IEnumerable<IGrouping<TKey, TElement>> in C# or IEnumerable(Of IGrouping(Of TKey, TElement)) in Visual Basic where each object contains a collection of objects of type  and a key. /// An whose elements to group. /// A function to extract the key for each element. /// A function to map each source element to an element in an . /// An to compare keys. /// The type of the elements of . /// The type of the key returned by . /// The type of the elements in the . /// /// or or is null. // Token: 0x060002B5 RID: 693 RVA: 0x0000E42C File Offset: 0x0000C62C public static IEnumerable> GroupBy(this IEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer comparer) { Check.SourceAndKeyElementSelectors(source, keySelector, elementSelector); return source.CreateGroupByIterator(keySelector, elementSelector, comparer); } // Token: 0x060002B6 RID: 694 RVA: 0x0000E440 File Offset: 0x0000C640 private static IEnumerable> CreateGroupByIterator(this IEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer comparer) { Dictionary> groups = new Dictionary>(); List nullList = new List(); int counter = 0; int nullCounter = -1; foreach (TSource item in source) { TKey key = keySelector(item); TElement element = elementSelector(item); if (key == null) { nullList.Add(element); if (nullCounter == -1) { nullCounter = counter; counter++; } } else { List group = Enumerable.ContainsGroup(groups, key, comparer); if (group == null) { group = new List(); groups.Add(key, group); counter++; } group.Add(element); } } counter = 0; foreach (KeyValuePair> group2 in groups) { if (counter == nullCounter) { yield return new Grouping(default(TKey), nullList); counter++; } yield return new Grouping(group2.Key, group2.Value); counter++; } if (counter == nullCounter) { yield return new Grouping(default(TKey), nullList); counter++; } yield break; } /// Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The elements of each group are projected by using a specified function. /// A collection of elements of type where each element represents a projection over a group and its key. /// An whose elements to group. /// A function to extract the key for each element. /// A function to map each source element to an element in an . /// A function to create a result value from each group. /// The type of the elements of . /// The type of the key returned by . /// The type of the elements in each . /// The type of the result value returned by . // Token: 0x060002B7 RID: 695 RVA: 0x0000E494 File Offset: 0x0000C694 public static IEnumerable GroupBy(this IEnumerable source, Func keySelector, Func elementSelector, Func, TResult> resultSelector) { return source.GroupBy(keySelector, elementSelector, resultSelector, null); } /// Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Key values are compared by using a specified comparer, and the elements of each group are projected by using a specified function. /// A collection of elements of type where each element represents a projection over a group and its key. /// An whose elements to group. /// A function to extract the key for each element. /// A function to map each source element to an element in an . /// A function to create a result value from each group. /// An to compare keys with. /// The type of the elements of . /// The type of the key returned by . /// The type of the elements in each . /// The type of the result value returned by . // Token: 0x060002B8 RID: 696 RVA: 0x0000E4A0 File Offset: 0x0000C6A0 public static IEnumerable GroupBy(this IEnumerable source, Func keySelector, Func elementSelector, Func, TResult> resultSelector, IEqualityComparer comparer) { Check.GroupBySelectors(source, keySelector, elementSelector, resultSelector); return source.CreateGroupByIterator(keySelector, elementSelector, resultSelector, comparer); } // Token: 0x060002B9 RID: 697 RVA: 0x0000E4B8 File Offset: 0x0000C6B8 private static IEnumerable CreateGroupByIterator(this IEnumerable source, Func keySelector, Func elementSelector, Func, TResult> resultSelector, IEqualityComparer comparer) { IEnumerable> groups = source.GroupBy(keySelector, elementSelector, comparer); foreach (IGrouping group in groups) { yield return resultSelector(group.Key, group); } yield break; } /// Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. /// A collection of elements of type where each element represents a projection over a group and its key. /// An whose elements to group. /// A function to extract the key for each element. /// A function to create a result value from each group. /// The type of the elements of . /// The type of the key returned by . /// The type of the result value returned by . // Token: 0x060002BA RID: 698 RVA: 0x0000E51C File Offset: 0x0000C71C public static IEnumerable GroupBy(this IEnumerable source, Func keySelector, Func, TResult> resultSelector) { return source.GroupBy(keySelector, resultSelector, null); } /// Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The keys are compared by using a specified comparer. /// A collection of elements of type where each element represents a projection over a group and its key. /// An whose elements to group. /// A function to extract the key for each element. /// A function to create a result value from each group. /// An to compare keys with. /// The type of the elements of . /// The type of the key returned by . /// The type of the result value returned by . // Token: 0x060002BB RID: 699 RVA: 0x0000E528 File Offset: 0x0000C728 public static IEnumerable GroupBy(this IEnumerable source, Func keySelector, Func, TResult> resultSelector, IEqualityComparer comparer) { Check.SourceAndKeyResultSelectors(source, keySelector, resultSelector); return source.CreateGroupByIterator(keySelector, resultSelector, comparer); } // Token: 0x060002BC RID: 700 RVA: 0x0000E53C File Offset: 0x0000C73C private static IEnumerable CreateGroupByIterator(this IEnumerable source, Func keySelector, Func, TResult> resultSelector, IEqualityComparer comparer) { IEnumerable> groups = source.GroupBy(keySelector, comparer); foreach (IGrouping group in groups) { yield return resultSelector(group.Key, group); } yield break; } /// Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys. /// An that contains elements of type that are obtained by performing a grouped join on two sequences. /// The first sequence to join. /// The sequence to join to the first sequence. /// A function to extract the join key from each element of the first sequence. /// A function to extract the join key from each element of the second sequence. /// A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. /// The type of the elements of the first sequence. /// The type of the elements of the second sequence. /// The type of the keys returned by the key selector functions. /// The type of the result elements. /// /// or or or or is null. // Token: 0x060002BD RID: 701 RVA: 0x0000E590 File Offset: 0x0000C790 public static IEnumerable GroupJoin(this IEnumerable outer, IEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func, TResult> resultSelector) { return outer.GroupJoin(inner, outerKeySelector, innerKeySelector, resultSelector, null); } /// Correlates the elements of two sequences based on key equality and groups the results. A specified is used to compare keys. /// An that contains elements of type that are obtained by performing a grouped join on two sequences. /// The first sequence to join. /// The sequence to join to the first sequence. /// A function to extract the join key from each element of the first sequence. /// A function to extract the join key from each element of the second sequence. /// A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. /// An to hash and compare keys. /// The type of the elements of the first sequence. /// The type of the elements of the second sequence. /// The type of the keys returned by the key selector functions. /// The type of the result elements. /// /// or or or or is null. // Token: 0x060002BE RID: 702 RVA: 0x0000E5A0 File Offset: 0x0000C7A0 public static IEnumerable GroupJoin(this IEnumerable outer, IEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func, TResult> resultSelector, IEqualityComparer comparer) { Check.JoinSelectors(outer, inner, outerKeySelector, innerKeySelector, resultSelector); if (comparer == null) { comparer = EqualityComparer.Default; } return outer.CreateGroupJoinIterator(inner, outerKeySelector, innerKeySelector, resultSelector, comparer); } // Token: 0x060002BF RID: 703 RVA: 0x0000E5D4 File Offset: 0x0000C7D4 private static IEnumerable CreateGroupJoinIterator(this IEnumerable outer, IEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func, TResult> resultSelector, IEqualityComparer comparer) { ILookup innerKeys = inner.ToLookup(innerKeySelector, comparer); foreach (TOuter element in outer) { TKey outerKey = outerKeySelector(element); if (innerKeys.Contains(outerKey)) { yield return resultSelector(element, innerKeys[outerKey]); } else { yield return resultSelector(element, Enumerable.Empty()); } } yield break; } /// Produces the set intersection of two sequences by using the default equality comparer to compare values. /// A sequence that contains the elements that form the set intersection of two sequences. /// An whose distinct elements that also appear in will be returned. /// An whose distinct elements that also appear in the first sequence will be returned. /// The type of the elements of the input sequences. /// /// or is null. // Token: 0x060002C0 RID: 704 RVA: 0x0000E648 File Offset: 0x0000C848 public static IEnumerable Intersect(this IEnumerable first, IEnumerable second) { return first.Intersect(second, null); } /// Produces the set intersection of two sequences by using the specified to compare values. /// A sequence that contains the elements that form the set intersection of two sequences. /// An whose distinct elements that also appear in will be returned. /// An whose distinct elements that also appear in the first sequence will be returned. /// An to compare values. /// The type of the elements of the input sequences. /// /// or is null. // Token: 0x060002C1 RID: 705 RVA: 0x0000E654 File Offset: 0x0000C854 public static IEnumerable Intersect(this IEnumerable first, IEnumerable second, IEqualityComparer comparer) { Check.FirstAndSecond(first, second); if (comparer == null) { comparer = EqualityComparer.Default; } return Enumerable.CreateIntersectIterator(first, second, comparer); } // Token: 0x060002C2 RID: 706 RVA: 0x0000E674 File Offset: 0x0000C874 private static IEnumerable CreateIntersectIterator(IEnumerable first, IEnumerable second, IEqualityComparer comparer) { HashSet items = new HashSet(second, comparer); foreach (TSource element in first) { if (items.Remove(element)) { yield return element; } } yield break; } /// Correlates the elements of two sequences based on matching keys. A specified is used to compare keys. /// An that has elements of type that are obtained by performing an inner join on two sequences. /// The first sequence to join. /// The sequence to join to the first sequence. /// A function to extract the join key from each element of the first sequence. /// A function to extract the join key from each element of the second sequence. /// A function to create a result element from two matching elements. /// An to hash and compare keys. /// The type of the elements of the first sequence. /// The type of the elements of the second sequence. /// The type of the keys returned by the key selector functions. /// The type of the result elements. /// /// or or or or is null. // Token: 0x060002C3 RID: 707 RVA: 0x0000E6BC File Offset: 0x0000C8BC public static IEnumerable Join(this IEnumerable outer, IEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func resultSelector, IEqualityComparer comparer) { Check.JoinSelectors(outer, inner, outerKeySelector, innerKeySelector, resultSelector); if (comparer == null) { comparer = EqualityComparer.Default; } return outer.CreateJoinIterator(inner, outerKeySelector, innerKeySelector, resultSelector, comparer); } // Token: 0x060002C4 RID: 708 RVA: 0x0000E6F0 File Offset: 0x0000C8F0 private static IEnumerable CreateJoinIterator(this IEnumerable outer, IEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func resultSelector, IEqualityComparer comparer) { ILookup innerKeys = inner.ToLookup(innerKeySelector, comparer); foreach (TOuter element in outer) { TKey outerKey = outerKeySelector(element); if (innerKeys.Contains(outerKey)) { foreach (TInner innerElement in innerKeys[outerKey]) { yield return resultSelector(element, innerElement); } } } yield break; } /// Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys. /// An that has elements of type that are obtained by performing an inner join on two sequences. /// The first sequence to join. /// The sequence to join to the first sequence. /// A function to extract the join key from each element of the first sequence. /// A function to extract the join key from each element of the second sequence. /// A function to create a result element from two matching elements. /// The type of the elements of the first sequence. /// The type of the elements of the second sequence. /// The type of the keys returned by the key selector functions. /// The type of the result elements. /// /// or or or or is null. // Token: 0x060002C5 RID: 709 RVA: 0x0000E764 File Offset: 0x0000C964 public static IEnumerable Join(this IEnumerable outer, IEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func resultSelector) { return outer.Join(inner, outerKeySelector, innerKeySelector, resultSelector, null); } // Token: 0x060002C6 RID: 710 RVA: 0x0000E774 File Offset: 0x0000C974 private static TSource Last(this IEnumerable source, Func predicate, Enumerable.Fallback fallback) { bool flag = true; TSource tsource = default(TSource); foreach (TSource tsource2 in source) { if (predicate(tsource2)) { tsource = tsource2; flag = false; } } if (!flag) { return tsource; } if (fallback == Enumerable.Fallback.Throw) { throw new InvalidOperationException(); } return tsource; } /// Returns the last element of a sequence. /// The value at the last position in the source sequence. /// An to return the last element of. /// The type of the elements of . /// /// is null. /// The source sequence is empty. // Token: 0x060002C7 RID: 711 RVA: 0x0000E804 File Offset: 0x0000CA04 public static TSource Last(this IEnumerable source) { Check.Source(source); ICollection collection = source as ICollection; if (collection != null && collection.Count == 0) { throw new InvalidOperationException(); } IList list = source as IList; if (list != null) { return list[list.Count - 1]; } bool flag = true; TSource tsource = default(TSource); foreach (TSource tsource2 in source) { tsource = tsource2; flag = false; } if (!flag) { return tsource; } throw new InvalidOperationException(); } /// Returns the last element of a sequence that satisfies a specified condition. /// The last element in the sequence that passes the test in the specified predicate function. /// An to return an element from. /// A function to test each element for a condition. /// The type of the elements of . /// /// or is null. /// No element satisfies the condition in .-or-The source sequence is empty. // Token: 0x060002C8 RID: 712 RVA: 0x0000E8C0 File Offset: 0x0000CAC0 public static TSource Last(this IEnumerable source, Func predicate) { Check.SourceAndPredicate(source, predicate); return source.Last(predicate, Enumerable.Fallback.Throw); } /// Returns the last element of a sequence, or a default value if the sequence contains no elements. /// default() if the source sequence is empty; otherwise, the last element in the . /// An to return the last element of. /// The type of the elements of . /// /// is null. // Token: 0x060002C9 RID: 713 RVA: 0x0000E8D4 File Offset: 0x0000CAD4 public static TSource LastOrDefault(this IEnumerable source) { Check.Source(source); IList list = source as IList; if (list != null) { return (list.Count <= 0) ? default(TSource) : list[list.Count - 1]; } bool flag = true; TSource tsource = default(TSource); foreach (TSource tsource2 in source) { tsource = tsource2; flag = false; } if (!flag) { return tsource; } return tsource; } /// Returns the last element of a sequence that satisfies a condition or a default value if no such element is found. /// default() if the sequence is empty or if no elements pass the test in the predicate function; otherwise, the last element that passes the test in the predicate function. /// An to return an element from. /// A function to test each element for a condition. /// The type of the elements of . /// /// or is null. // Token: 0x060002CA RID: 714 RVA: 0x0000E988 File Offset: 0x0000CB88 public static TSource LastOrDefault(this IEnumerable source, Func predicate) { Check.SourceAndPredicate(source, predicate); return source.Last(predicate, Enumerable.Fallback.Default); } /// Returns an that represents the total number of elements in a sequence. /// The number of elements in the source sequence. /// An that contains the elements to be counted. /// The type of the elements of . /// /// is null. /// The number of elements exceeds . // Token: 0x060002CB RID: 715 RVA: 0x0000E99C File Offset: 0x0000CB9C public static long LongCount(this IEnumerable source) { Check.Source(source); long num = 0L; using (IEnumerator enumerator = source.GetEnumerator()) { while (enumerator.MoveNext()) { num += 1L; } } return num; } /// Returns an that represents how many elements in a sequence satisfy a condition. /// A number that represents how many elements in the sequence satisfy the condition in the predicate function. /// An that contains the elements to be counted. /// A function to test each element for a condition. /// The type of the elements of . /// /// or is null. /// The number of matching elements exceeds . // Token: 0x060002CC RID: 716 RVA: 0x0000EA00 File Offset: 0x0000CC00 public static long LongCount(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); long num = 0L; foreach (TSource tsource in source) { if (selector(tsource)) { num += 1L; } } return num; } /// Returns the maximum value in a sequence of values. /// The maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// /// is null. /// /// contains no elements. // Token: 0x060002CD RID: 717 RVA: 0x0000EA74 File Offset: 0x0000CC74 public static int Max(this IEnumerable source) { Check.Source(source); return Enumerable.Iterate(source, int.MinValue, (int a, int b) => Math.Max(a, b)); } /// Returns the maximum value in a sequence of values. /// The maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// /// is null. /// /// contains no elements. // Token: 0x060002CE RID: 718 RVA: 0x0000EAB0 File Offset: 0x0000CCB0 public static long Max(this IEnumerable source) { Check.Source(source); return Enumerable.Iterate(source, long.MinValue, (long a, long b) => Math.Max(a, b)); } /// Returns the maximum value in a sequence of values. /// The maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// /// is null. /// /// contains no elements. // Token: 0x060002CF RID: 719 RVA: 0x0000EAF0 File Offset: 0x0000CCF0 public static double Max(this IEnumerable source) { Check.Source(source); return Enumerable.Iterate(source, double.MinValue, (double a, double b) => Math.Max(a, b)); } /// Returns the maximum value in a sequence of values. /// The maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// /// is null. /// /// contains no elements. // Token: 0x060002D0 RID: 720 RVA: 0x0000EB30 File Offset: 0x0000CD30 public static float Max(this IEnumerable source) { Check.Source(source); return Enumerable.Iterate(source, float.MinValue, (float a, float b) => Math.Max(a, b)); } /// Returns the maximum value in a sequence of values. /// The maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// /// is null. /// /// contains no elements. // Token: 0x060002D1 RID: 721 RVA: 0x0000EB6C File Offset: 0x0000CD6C public static decimal Max(this IEnumerable source) { Check.Source(source); return Enumerable.Iterate(source, decimal.MinValue, (decimal a, decimal b) => Math.Max(a, b)); } /// Returns the maximum value in a sequence of nullable values. /// A value of type Nullable<Int32> in C# or Nullable(Of Int32) in Visual Basic that corresponds to the maximum value in the sequence.  /// A sequence of nullable values to determine the maximum value of. /// /// is null. // Token: 0x060002D2 RID: 722 RVA: 0x0000EBA4 File Offset: 0x0000CDA4 public static int? Max(this IEnumerable source) { Check.Source(source); return Enumerable.IterateNullable(source, (int a, int b) => Math.Max(a, b)); } /// Returns the maximum value in a sequence of nullable values. /// A value of type Nullable<Int64> in C# or Nullable(Of Int64) in Visual Basic that corresponds to the maximum value in the sequence.  /// A sequence of nullable values to determine the maximum value of. /// /// is null. // Token: 0x060002D3 RID: 723 RVA: 0x0000EBD0 File Offset: 0x0000CDD0 public static long? Max(this IEnumerable source) { Check.Source(source); return Enumerable.IterateNullable(source, (long a, long b) => Math.Max(a, b)); } /// Returns the maximum value in a sequence of nullable values. /// A value of type Nullable<Double> in C# or Nullable(Of Double) in Visual Basic that corresponds to the maximum value in the sequence. /// A sequence of nullable values to determine the maximum value of. /// /// is null. // Token: 0x060002D4 RID: 724 RVA: 0x0000EBFC File Offset: 0x0000CDFC public static double? Max(this IEnumerable source) { Check.Source(source); return Enumerable.IterateNullable(source, (double a, double b) => Math.Max(a, b)); } /// Returns the maximum value in a sequence of nullable values. /// A value of type Nullable<Single> in C# or Nullable(Of Single) in Visual Basic that corresponds to the maximum value in the sequence. /// A sequence of nullable values to determine the maximum value of. /// /// is null. // Token: 0x060002D5 RID: 725 RVA: 0x0000EC28 File Offset: 0x0000CE28 public static float? Max(this IEnumerable source) { Check.Source(source); return Enumerable.IterateNullable(source, (float a, float b) => Math.Max(a, b)); } /// Returns the maximum value in a sequence of nullable values. /// A value of type Nullable<Decimal> in C# or Nullable(Of Decimal) in Visual Basic that corresponds to the maximum value in the sequence.  /// A sequence of nullable values to determine the maximum value of. /// /// is null. // Token: 0x060002D6 RID: 726 RVA: 0x0000EC54 File Offset: 0x0000CE54 public static decimal? Max(this IEnumerable source) { Check.Source(source); return Enumerable.IterateNullable(source, (decimal a, decimal b) => Math.Max(a, b)); } // Token: 0x060002D7 RID: 727 RVA: 0x0000EC80 File Offset: 0x0000CE80 private static T? IterateNullable(IEnumerable source, Func selector) where T : struct { bool flag = true; T? t = null; foreach (T? t2 in source) { if (t2 != null) { if (t == null) { t = new T?(t2.Value); } else { t = new T?(selector(t2.Value, t.Value)); } flag = false; } } if (flag) { return null; } return t; } // Token: 0x060002D8 RID: 728 RVA: 0x0000ED44 File Offset: 0x0000CF44 private static TRet? IterateNullable(IEnumerable source, Func source_selector, Func selector) where TRet : struct { bool flag = true; TRet? tret = null; foreach (TSource tsource in source) { TRet? tret2 = source_selector(tsource); if (tret == null) { tret = tret2; } else if (selector(tret2, tret)) { tret = tret2; } flag = false; } if (flag) { return null; } return tret; } // Token: 0x060002D9 RID: 729 RVA: 0x0000EDEC File Offset: 0x0000CFEC private static TSource IterateNullable(IEnumerable source, Func selector) { TSource tsource = default(TSource); foreach (TSource tsource2 in source) { if (tsource2 != null) { if (tsource == null || selector(tsource2, tsource)) { tsource = tsource2; } } } return tsource; } // Token: 0x060002DA RID: 730 RVA: 0x0000EE78 File Offset: 0x0000D078 private static TSource IterateNonNullable(IEnumerable source, Func selector) { TSource tsource = default(TSource); bool flag = true; foreach (TSource tsource2 in source) { if (flag) { tsource = tsource2; flag = false; } else if (selector(tsource2, tsource)) { tsource = tsource2; } } if (flag) { throw new InvalidOperationException(); } return tsource; } /// Returns the maximum value in a generic sequence. /// The maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// The type of the elements of . /// /// is null. // Token: 0x060002DB RID: 731 RVA: 0x0000EF08 File Offset: 0x0000D108 public static TSource Max(this IEnumerable source) { Check.Source(source); Comparer comparer = Comparer.Default; Func func = (TSource a, TSource b) => comparer.Compare(a, b) > 0; if (default(TSource) == null) { return Enumerable.IterateNullable(source, func); } return Enumerable.IterateNonNullable(source, func); } /// Invokes a transform function on each element of a sequence and returns the maximum value. /// The maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. // Token: 0x060002DC RID: 732 RVA: 0x0000EF5C File Offset: 0x0000D15C public static int Max(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.Iterate(source, int.MinValue, (TSource a, int b) => Math.Max(selector(a), b)); } /// Invokes a transform function on each element of a sequence and returns the maximum value. /// The maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. // Token: 0x060002DD RID: 733 RVA: 0x0000EF9C File Offset: 0x0000D19C public static long Max(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.Iterate(source, long.MinValue, (TSource a, long b) => Math.Max(selector(a), b)); } /// Invokes a transform function on each element of a sequence and returns the maximum value. /// The maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. // Token: 0x060002DE RID: 734 RVA: 0x0000EFE0 File Offset: 0x0000D1E0 public static double Max(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.Iterate(source, double.MinValue, (TSource a, double b) => Math.Max(selector(a), b)); } /// Invokes a transform function on each element of a sequence and returns the maximum value. /// The maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. // Token: 0x060002DF RID: 735 RVA: 0x0000F024 File Offset: 0x0000D224 public static float Max(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.Iterate(source, float.MinValue, (TSource a, float b) => Math.Max(selector(a), b)); } /// Invokes a transform function on each element of a sequence and returns the maximum value. /// The maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. // Token: 0x060002E0 RID: 736 RVA: 0x0000F064 File Offset: 0x0000D264 public static decimal Max(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.Iterate(source, decimal.MinValue, (TSource a, decimal b) => Math.Max(selector(a), b)); } // Token: 0x060002E1 RID: 737 RVA: 0x0000F0A8 File Offset: 0x0000D2A8 private static U Iterate(IEnumerable source, U initValue, Func selector) { bool flag = true; foreach (T t in source) { initValue = selector(t, initValue); flag = false; } if (flag) { throw new InvalidOperationException(); } return initValue; } /// Invokes a transform function on each element of a sequence and returns the maximum nullable value. /// The value of type Nullable<Int32> in C# or Nullable(Of Int32) in Visual Basic that corresponds to the maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x060002E2 RID: 738 RVA: 0x0000F11C File Offset: 0x0000D31C public static int? Max(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.IterateNullable(source, selector, (int? a, int? b) => a != null && b != null && a.Value > b.Value); } /// Invokes a transform function on each element of a sequence and returns the maximum nullable value. /// The value of type Nullable<Int64> in C# or Nullable(Of Int64) in Visual Basic that corresponds to the maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x060002E3 RID: 739 RVA: 0x0000F138 File Offset: 0x0000D338 public static long? Max(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.IterateNullable(source, selector, (long? a, long? b) => a != null && b != null && a.Value > b.Value); } /// Invokes a transform function on each element of a sequence and returns the maximum nullable value. /// The value of type Nullable<Double> in C# or Nullable(Of Double) in Visual Basic that corresponds to the maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x060002E4 RID: 740 RVA: 0x0000F154 File Offset: 0x0000D354 public static double? Max(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.IterateNullable(source, selector, (double? a, double? b) => a != null && b != null && a.Value > b.Value); } /// Invokes a transform function on each element of a sequence and returns the maximum nullable value. /// The value of type Nullable<Single> in C# or Nullable(Of Single) in Visual Basic that corresponds to the maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x060002E5 RID: 741 RVA: 0x0000F170 File Offset: 0x0000D370 public static float? Max(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.IterateNullable(source, selector, (float? a, float? b) => a != null && b != null && a.Value > b.Value); } /// Invokes a transform function on each element of a sequence and returns the maximum nullable value. /// The value of type Nullable<Decimal> in C# or Nullable(Of Decimal) in Visual Basic that corresponds to the maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x060002E6 RID: 742 RVA: 0x0000F18C File Offset: 0x0000D38C public static decimal? Max(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.IterateNullable(source, selector, (decimal? a, decimal? b) => a != null && b != null && a.Value > b.Value); } /// Invokes a transform function on each element of a generic sequence and returns the maximum resulting value. /// The maximum value in the sequence. /// A sequence of values to determine the maximum value of. /// A transform function to apply to each element. /// The type of the elements of . /// The type of the value returned by . /// /// or is null. // Token: 0x060002E7 RID: 743 RVA: 0x0000F1A8 File Offset: 0x0000D3A8 public static TResult Max(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return source.Select(selector).Max(); } /// Returns the minimum value in a sequence of values. /// The minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// /// is null. /// /// contains no elements. // Token: 0x060002E8 RID: 744 RVA: 0x0000F1C0 File Offset: 0x0000D3C0 public static int Min(this IEnumerable source) { Check.Source(source); return Enumerable.Iterate(source, int.MaxValue, (int a, int b) => Math.Min(a, b)); } /// Returns the minimum value in a sequence of values. /// The minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// /// is null. /// /// contains no elements. // Token: 0x060002E9 RID: 745 RVA: 0x0000F1FC File Offset: 0x0000D3FC public static long Min(this IEnumerable source) { Check.Source(source); return Enumerable.Iterate(source, long.MaxValue, (long a, long b) => Math.Min(a, b)); } /// Returns the minimum value in a sequence of values. /// The minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// /// is null. /// /// contains no elements. // Token: 0x060002EA RID: 746 RVA: 0x0000F23C File Offset: 0x0000D43C public static double Min(this IEnumerable source) { Check.Source(source); return Enumerable.Iterate(source, double.MaxValue, (double a, double b) => Math.Min(a, b)); } /// Returns the minimum value in a sequence of values. /// The minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// /// is null. /// /// contains no elements. // Token: 0x060002EB RID: 747 RVA: 0x0000F27C File Offset: 0x0000D47C public static float Min(this IEnumerable source) { Check.Source(source); return Enumerable.Iterate(source, float.MaxValue, (float a, float b) => Math.Min(a, b)); } /// Returns the minimum value in a sequence of values. /// The minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// /// is null. /// /// contains no elements. // Token: 0x060002EC RID: 748 RVA: 0x0000F2B8 File Offset: 0x0000D4B8 public static decimal Min(this IEnumerable source) { Check.Source(source); return Enumerable.Iterate(source, decimal.MaxValue, (decimal a, decimal b) => Math.Min(a, b)); } /// Returns the minimum value in a sequence of nullable values. /// A value of type Nullable<Int32> in C# or Nullable(Of Int32) in Visual Basic that corresponds to the minimum value in the sequence. /// A sequence of nullable values to determine the minimum value of. /// /// is null. // Token: 0x060002ED RID: 749 RVA: 0x0000F2F0 File Offset: 0x0000D4F0 public static int? Min(this IEnumerable source) { Check.Source(source); return Enumerable.IterateNullable(source, (int a, int b) => Math.Min(a, b)); } /// Returns the minimum value in a sequence of nullable values. /// A value of type Nullable<Int64> in C# or Nullable(Of Int64) in Visual Basic that corresponds to the minimum value in the sequence. /// A sequence of nullable values to determine the minimum value of. /// /// is null. // Token: 0x060002EE RID: 750 RVA: 0x0000F31C File Offset: 0x0000D51C public static long? Min(this IEnumerable source) { Check.Source(source); return Enumerable.IterateNullable(source, (long a, long b) => Math.Min(a, b)); } /// Returns the minimum value in a sequence of nullable values. /// A value of type Nullable<Double> in C# or Nullable(Of Double) in Visual Basic that corresponds to the minimum value in the sequence. /// A sequence of nullable values to determine the minimum value of. /// /// is null. // Token: 0x060002EF RID: 751 RVA: 0x0000F348 File Offset: 0x0000D548 public static double? Min(this IEnumerable source) { Check.Source(source); return Enumerable.IterateNullable(source, (double a, double b) => Math.Min(a, b)); } /// Returns the minimum value in a sequence of nullable values. /// A value of type Nullable<Single> in C# or Nullable(Of Single) in Visual Basic that corresponds to the minimum value in the sequence. /// A sequence of nullable values to determine the minimum value of. /// /// is null. // Token: 0x060002F0 RID: 752 RVA: 0x0000F374 File Offset: 0x0000D574 public static float? Min(this IEnumerable source) { Check.Source(source); return Enumerable.IterateNullable(source, (float a, float b) => Math.Min(a, b)); } /// Returns the minimum value in a sequence of nullable values. /// A value of type Nullable<Decimal> in C# or Nullable(Of Decimal) in Visual Basic that corresponds to the minimum value in the sequence. /// A sequence of nullable values to determine the minimum value of. /// /// is null. // Token: 0x060002F1 RID: 753 RVA: 0x0000F3A0 File Offset: 0x0000D5A0 public static decimal? Min(this IEnumerable source) { Check.Source(source); return Enumerable.IterateNullable(source, (decimal a, decimal b) => Math.Min(a, b)); } /// Returns the minimum value in a generic sequence. /// The minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// The type of the elements of . /// /// is null. // Token: 0x060002F2 RID: 754 RVA: 0x0000F3CC File Offset: 0x0000D5CC public static TSource Min(this IEnumerable source) { Check.Source(source); Comparer comparer = Comparer.Default; Func func = (TSource a, TSource b) => comparer.Compare(a, b) < 0; if (default(TSource) == null) { return Enumerable.IterateNullable(source, func); } return Enumerable.IterateNonNullable(source, func); } /// Invokes a transform function on each element of a sequence and returns the minimum value. /// The minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. // Token: 0x060002F3 RID: 755 RVA: 0x0000F420 File Offset: 0x0000D620 public static int Min(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.Iterate(source, int.MaxValue, (TSource a, int b) => Math.Min(selector(a), b)); } /// Invokes a transform function on each element of a sequence and returns the minimum value. /// The minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. // Token: 0x060002F4 RID: 756 RVA: 0x0000F460 File Offset: 0x0000D660 public static long Min(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.Iterate(source, long.MaxValue, (TSource a, long b) => Math.Min(selector(a), b)); } /// Invokes a transform function on each element of a sequence and returns the minimum value. /// The minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. // Token: 0x060002F5 RID: 757 RVA: 0x0000F4A4 File Offset: 0x0000D6A4 public static double Min(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.Iterate(source, double.MaxValue, (TSource a, double b) => Math.Min(selector(a), b)); } /// Invokes a transform function on each element of a sequence and returns the minimum value. /// The minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. // Token: 0x060002F6 RID: 758 RVA: 0x0000F4E8 File Offset: 0x0000D6E8 public static float Min(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.Iterate(source, float.MaxValue, (TSource a, float b) => Math.Min(selector(a), b)); } /// Invokes a transform function on each element of a sequence and returns the minimum value. /// The minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// /// contains no elements. // Token: 0x060002F7 RID: 759 RVA: 0x0000F528 File Offset: 0x0000D728 public static decimal Min(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.Iterate(source, decimal.MaxValue, (TSource a, decimal b) => Math.Min(selector(a), b)); } /// Invokes a transform function on each element of a sequence and returns the minimum nullable value. /// The value of type Nullable<Int32> in C# or Nullable(Of Int32) in Visual Basic that corresponds to the minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x060002F8 RID: 760 RVA: 0x0000F56C File Offset: 0x0000D76C public static int? Min(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.IterateNullable(source, selector, (int? a, int? b) => a != null && b != null && a.Value < b.Value); } /// Invokes a transform function on each element of a sequence and returns the minimum nullable value. /// The value of type Nullable<Int64> in C# or Nullable(Of Int64) in Visual Basic that corresponds to the minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x060002F9 RID: 761 RVA: 0x0000F588 File Offset: 0x0000D788 public static long? Min(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.IterateNullable(source, selector, (long? a, long? b) => a != null && b != null && a.Value < b.Value); } /// Invokes a transform function on each element of a sequence and returns the minimum nullable value. /// The value of type Nullable<Single> in C# or Nullable(Of Single) in Visual Basic that corresponds to the minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x060002FA RID: 762 RVA: 0x0000F5A4 File Offset: 0x0000D7A4 public static float? Min(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.IterateNullable(source, selector, (float? a, float? b) => a != null && b != null && a.Value < b.Value); } /// Invokes a transform function on each element of a sequence and returns the minimum nullable value. /// The value of type Nullable<Double> in C# or Nullable(Of Double) in Visual Basic that corresponds to the minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x060002FB RID: 763 RVA: 0x0000F5C0 File Offset: 0x0000D7C0 public static double? Min(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.IterateNullable(source, selector, (double? a, double? b) => a != null && b != null && a.Value < b.Value); } /// Invokes a transform function on each element of a sequence and returns the minimum nullable value. /// The value of type Nullable<Decimal> in C# or Nullable(Of Decimal) in Visual Basic that corresponds to the minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x060002FC RID: 764 RVA: 0x0000F5DC File Offset: 0x0000D7DC public static decimal? Min(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.IterateNullable(source, selector, (decimal? a, decimal? b) => a != null && b != null && a.Value < b.Value); } /// Invokes a transform function on each element of a generic sequence and returns the minimum resulting value. /// The minimum value in the sequence. /// A sequence of values to determine the minimum value of. /// A transform function to apply to each element. /// The type of the elements of . /// The type of the value returned by . /// /// or is null. // Token: 0x060002FD RID: 765 RVA: 0x0000F5F8 File Offset: 0x0000D7F8 public static TResult Min(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return source.Select(selector).Min(); } /// Filters the elements of an based on a specified type. /// An that contains elements from the input sequence of type . /// The whose elements to filter. /// The type to filter the elements of the sequence on. /// /// is null. // Token: 0x060002FE RID: 766 RVA: 0x0000F610 File Offset: 0x0000D810 public static IEnumerable OfType(this IEnumerable source) { Check.Source(source); return Enumerable.CreateOfTypeIterator(source); } // Token: 0x060002FF RID: 767 RVA: 0x0000F620 File Offset: 0x0000D820 private static IEnumerable CreateOfTypeIterator(IEnumerable source) { foreach (object element in source) { if (element is TResult) { yield return (TResult)((object)element); } } yield break; } /// Sorts the elements of a sequence in ascending order according to a key. /// An whose elements are sorted according to a key. /// A sequence of values to order. /// A function to extract a key from an element. /// The type of the elements of . /// The type of the key returned by . /// /// or is null. // Token: 0x06000300 RID: 768 RVA: 0x0000F64C File Offset: 0x0000D84C public static IOrderedEnumerable OrderBy(this IEnumerable source, Func keySelector) { return source.OrderBy(keySelector, null); } /// Sorts the elements of a sequence in ascending order by using a specified comparer. /// An whose elements are sorted according to a key. /// A sequence of values to order. /// A function to extract a key from an element. /// An to compare keys. /// The type of the elements of . /// The type of the key returned by . /// /// or is null. // Token: 0x06000301 RID: 769 RVA: 0x0000F658 File Offset: 0x0000D858 public static IOrderedEnumerable OrderBy(this IEnumerable source, Func keySelector, IComparer comparer) { Check.SourceAndKeySelector(source, keySelector); return new OrderedSequence(source, keySelector, comparer, SortDirection.Ascending); } /// Sorts the elements of a sequence in descending order according to a key. /// An whose elements are sorted in descending order according to a key. /// A sequence of values to order. /// A function to extract a key from an element. /// The type of the elements of . /// The type of the key returned by . /// /// or is null. // Token: 0x06000302 RID: 770 RVA: 0x0000F66C File Offset: 0x0000D86C public static IOrderedEnumerable OrderByDescending(this IEnumerable source, Func keySelector) { return source.OrderByDescending(keySelector, null); } /// Sorts the elements of a sequence in descending order by using a specified comparer. /// An whose elements are sorted in descending order according to a key. /// A sequence of values to order. /// A function to extract a key from an element. /// An to compare keys. /// The type of the elements of . /// The type of the key returned by . /// /// or is null. // Token: 0x06000303 RID: 771 RVA: 0x0000F678 File Offset: 0x0000D878 public static IOrderedEnumerable OrderByDescending(this IEnumerable source, Func keySelector, IComparer comparer) { Check.SourceAndKeySelector(source, keySelector); return new OrderedSequence(source, keySelector, comparer, SortDirection.Descending); } /// Generates a sequence of integral numbers within a specified range. /// An IEnumerable<Int32> in C# or IEnumerable(Of Int32) in Visual Basic that contains a range of sequential integral numbers. /// The value of the first integer in the sequence. /// The number of sequential integers to generate. /// /// is less than 0.-or- + -1 is larger than . // Token: 0x06000304 RID: 772 RVA: 0x0000F68C File Offset: 0x0000D88C public static IEnumerable Range(int start, int count) { if (count < 0) { throw new ArgumentOutOfRangeException("count"); } long num = (long)start + (long)count - 1L; if (num > 2147483647L) { throw new ArgumentOutOfRangeException(); } return Enumerable.CreateRangeIterator(start, (int)num); } // Token: 0x06000305 RID: 773 RVA: 0x0000F6D0 File Offset: 0x0000D8D0 private static IEnumerable CreateRangeIterator(int start, int upto) { for (int i = start; i <= upto; i++) { yield return i; } yield break; } /// Generates a sequence that contains one repeated value. /// An that contains a repeated value. /// The value to be repeated. /// The number of times to repeat the value in the generated sequence. /// The type of the value to be repeated in the result sequence. /// /// is less than 0. // Token: 0x06000306 RID: 774 RVA: 0x0000F708 File Offset: 0x0000D908 public static IEnumerable Repeat(TResult element, int count) { if (count < 0) { throw new ArgumentOutOfRangeException(); } return Enumerable.CreateRepeatIterator(element, count); } // Token: 0x06000307 RID: 775 RVA: 0x0000F720 File Offset: 0x0000D920 private static IEnumerable CreateRepeatIterator(TResult element, int count) { for (int i = 0; i < count; i++) { yield return element; } yield break; } /// Inverts the order of the elements in a sequence. /// A sequence whose elements correspond to those of the input sequence in reverse order. /// A sequence of values to reverse. /// The type of the elements of . /// /// is null. // Token: 0x06000308 RID: 776 RVA: 0x0000F758 File Offset: 0x0000D958 public static IEnumerable Reverse(this IEnumerable source) { Check.Source(source); return Enumerable.CreateReverseIterator(source); } // Token: 0x06000309 RID: 777 RVA: 0x0000F768 File Offset: 0x0000D968 private static IEnumerable CreateReverseIterator(IEnumerable source) { IList list = source as IList; if (list == null) { list = new List(source); } for (int i = list.Count - 1; i >= 0; i--) { yield return list[i]; } yield break; } /// Projects each element of a sequence into a new form. /// An whose elements are the result of invoking the transform function on each element of . /// A sequence of values to invoke a transform function on. /// A transform function to apply to each element. /// The type of the elements of . /// The type of the value returned by . /// /// or is null. // Token: 0x0600030A RID: 778 RVA: 0x0000F794 File Offset: 0x0000D994 public static IEnumerable Select(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.CreateSelectIterator(source, selector); } // Token: 0x0600030B RID: 779 RVA: 0x0000F7A4 File Offset: 0x0000D9A4 private static IEnumerable CreateSelectIterator(IEnumerable source, Func selector) { foreach (TSource element in source) { yield return selector(element); } yield break; } /// Projects each element of a sequence into a new form by incorporating the element's index. /// An whose elements are the result of invoking the transform function on each element of . /// A sequence of values to invoke a transform function on. /// A transform function to apply to each source element; the second parameter of the function represents the index of the source element. /// The type of the elements of . /// The type of the value returned by . /// /// or is null. // Token: 0x0600030C RID: 780 RVA: 0x0000F7DC File Offset: 0x0000D9DC public static IEnumerable Select(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return Enumerable.CreateSelectIterator(source, selector); } // Token: 0x0600030D RID: 781 RVA: 0x0000F7EC File Offset: 0x0000D9EC private static IEnumerable CreateSelectIterator(IEnumerable source, Func selector) { int counter = 0; foreach (TSource element in source) { yield return selector(element, counter); counter++; } yield break; } /// Projects each element of a sequence to an and flattens the resulting sequences into one sequence. /// An whose elements are the result of invoking the one-to-many transform function on each element of the input sequence. /// A sequence of values to project. /// A transform function to apply to each element. /// The type of the elements of . /// The type of the elements of the sequence returned by . /// /// or is null. // Token: 0x0600030E RID: 782 RVA: 0x0000F824 File Offset: 0x0000DA24 public static IEnumerable SelectMany(this IEnumerable source, Func> selector) { Check.SourceAndSelector(source, selector); return Enumerable.CreateSelectManyIterator(source, selector); } // Token: 0x0600030F RID: 783 RVA: 0x0000F834 File Offset: 0x0000DA34 private static IEnumerable CreateSelectManyIterator(IEnumerable source, Func> selector) { foreach (TSource element in source) { foreach (TResult item in selector(element)) { yield return item; } } yield break; } /// Projects each element of a sequence to an , and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element. /// An whose elements are the result of invoking the one-to-many transform function on each element of an input sequence. /// A sequence of values to project. /// A transform function to apply to each source element; the second parameter of the function represents the index of the source element. /// The type of the elements of . /// The type of the elements of the sequence returned by . /// /// or is null. // Token: 0x06000310 RID: 784 RVA: 0x0000F86C File Offset: 0x0000DA6C public static IEnumerable SelectMany(this IEnumerable source, Func> selector) { Check.SourceAndSelector(source, selector); return Enumerable.CreateSelectManyIterator(source, selector); } // Token: 0x06000311 RID: 785 RVA: 0x0000F87C File Offset: 0x0000DA7C private static IEnumerable CreateSelectManyIterator(IEnumerable source, Func> selector) { int counter = 0; foreach (TSource element in source) { foreach (TResult item in selector(element, counter)) { yield return item; } counter++; } yield break; } /// Projects each element of a sequence to an , flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. /// An whose elements are the result of invoking the one-to-many transform function on each element of and then mapping each of those sequence elements and their corresponding source element to a result element. /// A sequence of values to project. /// A transform function to apply to each element of the input sequence. /// A transform function to apply to each element of the intermediate sequence. /// The type of the elements of . /// The type of the intermediate elements collected by . /// The type of the elements of the resulting sequence. /// /// or or is null. // Token: 0x06000312 RID: 786 RVA: 0x0000F8B4 File Offset: 0x0000DAB4 public static IEnumerable SelectMany(this IEnumerable source, Func> collectionSelector, Func selector) { Check.SourceAndCollectionSelectors(source, collectionSelector, selector); return Enumerable.CreateSelectManyIterator(source, collectionSelector, selector); } // Token: 0x06000313 RID: 787 RVA: 0x0000F8C8 File Offset: 0x0000DAC8 private static IEnumerable CreateSelectManyIterator(IEnumerable source, Func> collectionSelector, Func selector) { foreach (TSource element in source) { foreach (TCollection collection in collectionSelector(element)) { yield return selector(element, collection); } } yield break; } /// Projects each element of a sequence to an , flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. The index of each source element is used in the intermediate projected form of that element. /// An whose elements are the result of invoking the one-to-many transform function on each element of and then mapping each of those sequence elements and their corresponding source element to a result element. /// A sequence of values to project. /// A transform function to apply to each source element; the second parameter of the function represents the index of the source element. /// A transform function to apply to each element of the intermediate sequence. /// The type of the elements of . /// The type of the intermediate elements collected by . /// The type of the elements of the resulting sequence. /// /// or or is null. // Token: 0x06000314 RID: 788 RVA: 0x0000F910 File Offset: 0x0000DB10 public static IEnumerable SelectMany(this IEnumerable source, Func> collectionSelector, Func selector) { Check.SourceAndCollectionSelectors(source, collectionSelector, selector); return Enumerable.CreateSelectManyIterator(source, collectionSelector, selector); } // Token: 0x06000315 RID: 789 RVA: 0x0000F924 File Offset: 0x0000DB24 private static IEnumerable CreateSelectManyIterator(IEnumerable source, Func> collectionSelector, Func selector) { int counter = 0; foreach (TSource element in source) { TSource tsource = element; int num; counter = (num = counter) + 1; foreach (TCollection collection in collectionSelector(tsource, num)) { yield return selector(element, collection); } } yield break; } // Token: 0x06000316 RID: 790 RVA: 0x0000F96C File Offset: 0x0000DB6C private static TSource Single(this IEnumerable source, Func predicate, Enumerable.Fallback fallback) { bool flag = false; TSource tsource = default(TSource); foreach (TSource tsource2 in source) { if (predicate(tsource2)) { if (flag) { throw new InvalidOperationException(); } flag = true; tsource = tsource2; } } if (!flag && fallback == Enumerable.Fallback.Throw) { throw new InvalidOperationException(); } return tsource; } /// Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence. /// The single element of the input sequence. /// An to return the single element of. /// The type of the elements of . /// /// is null. /// The input sequence contains more than one element.-or-The input sequence is empty. // Token: 0x06000317 RID: 791 RVA: 0x0000FA08 File Offset: 0x0000DC08 public static TSource Single(this IEnumerable source) { Check.Source(source); bool flag = false; TSource tsource = default(TSource); foreach (TSource tsource2 in source) { if (flag) { throw new InvalidOperationException(); } flag = true; tsource = tsource2; } if (!flag) { throw new InvalidOperationException(); } return tsource; } /// Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists. /// The single element of the input sequence that satisfies a condition. /// An to return a single element from. /// A function to test an element for a condition. /// The type of the elements of . /// /// or is null. /// No element satisfies the condition in .-or-More than one element satisfies the condition in .-or-The source sequence is empty. // Token: 0x06000318 RID: 792 RVA: 0x0000FA90 File Offset: 0x0000DC90 public static TSource Single(this IEnumerable source, Func predicate) { Check.SourceAndPredicate(source, predicate); return source.Single(predicate, Enumerable.Fallback.Throw); } /// Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence. /// The single element of the input sequence, or default() if the sequence contains no elements. /// An to return the single element of. /// The type of the elements of . /// /// is null. /// The input sequence contains more than one element. // Token: 0x06000319 RID: 793 RVA: 0x0000FAA4 File Offset: 0x0000DCA4 public static TSource SingleOrDefault(this IEnumerable source) { Check.Source(source); bool flag = false; TSource tsource = default(TSource); foreach (TSource tsource2 in source) { if (flag) { throw new InvalidOperationException(); } flag = true; tsource = tsource2; } return tsource; } /// Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. /// The single element of the input sequence that satisfies the condition, or default() if no such element is found. /// An to return a single element from. /// A function to test an element for a condition. /// The type of the elements of . /// /// or is null. /// More than one element satisfies the condition in . // Token: 0x0600031A RID: 794 RVA: 0x0000FB20 File Offset: 0x0000DD20 public static TSource SingleOrDefault(this IEnumerable source, Func predicate) { Check.SourceAndPredicate(source, predicate); return source.Single(predicate, Enumerable.Fallback.Default); } /// Bypasses a specified number of elements in a sequence and then returns the remaining elements. /// An that contains the elements that occur after the specified index in the input sequence. /// An to return elements from. /// The number of elements to skip before returning the remaining elements. /// The type of the elements of . /// /// is null. // Token: 0x0600031B RID: 795 RVA: 0x0000FB34 File Offset: 0x0000DD34 public static IEnumerable Skip(this IEnumerable source, int count) { Check.Source(source); return Enumerable.CreateSkipIterator(source, count); } // Token: 0x0600031C RID: 796 RVA: 0x0000FB44 File Offset: 0x0000DD44 private static IEnumerable CreateSkipIterator(IEnumerable source, int count) { IEnumerator enumerator = source.GetEnumerator(); try { do { int num; count = (num = count) - 1; if (num <= 0) { goto Block_4; } } while (enumerator.MoveNext()); yield break; Block_4: while (enumerator.MoveNext()) { TSource tsource = enumerator.Current; yield return tsource; } } finally { enumerator.Dispose(); } yield break; } /// Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. /// An that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by . /// An to return elements from. /// A function to test each element for a condition. /// The type of the elements of . /// /// or is null. // Token: 0x0600031D RID: 797 RVA: 0x0000FB7C File Offset: 0x0000DD7C public static IEnumerable SkipWhile(this IEnumerable source, Func predicate) { Check.SourceAndPredicate(source, predicate); return Enumerable.CreateSkipWhileIterator(source, predicate); } // Token: 0x0600031E RID: 798 RVA: 0x0000FB8C File Offset: 0x0000DD8C private static IEnumerable CreateSkipWhileIterator(IEnumerable source, Func predicate) { bool yield = false; foreach (TSource element in source) { if (yield) { yield return element; } else if (!predicate(element)) { yield return element; yield = true; } } yield break; } /// Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of the predicate function. /// An that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by . /// An to return elements from. /// A function to test each source element for a condition; the second parameter of the function represents the index of the source element. /// The type of the elements of . /// /// or is null. // Token: 0x0600031F RID: 799 RVA: 0x0000FBC4 File Offset: 0x0000DDC4 public static IEnumerable SkipWhile(this IEnumerable source, Func predicate) { Check.SourceAndPredicate(source, predicate); return Enumerable.CreateSkipWhileIterator(source, predicate); } // Token: 0x06000320 RID: 800 RVA: 0x0000FBD4 File Offset: 0x0000DDD4 private static IEnumerable CreateSkipWhileIterator(IEnumerable source, Func predicate) { int counter = 0; bool yield = false; foreach (TSource element in source) { if (yield) { yield return element; } else if (!predicate(element, counter)) { yield return element; yield = true; } counter++; } yield break; } /// Computes the sum of a sequence of values. /// The sum of the values in the sequence. /// A sequence of values to calculate the sum of. /// /// is null. /// The sum is larger than . // Token: 0x06000321 RID: 801 RVA: 0x0000FC0C File Offset: 0x0000DE0C public static int Sum(this IEnumerable source) { Check.Source(source); return source.Sum((int a, int b) => checked(a + b)); } /// Computes the sum of a sequence of nullable values. /// The sum of the values in the sequence. /// A sequence of nullable values to calculate the sum of. /// /// is null. /// The sum is larger than . // Token: 0x06000322 RID: 802 RVA: 0x0000FC38 File Offset: 0x0000DE38 public static int? Sum(this IEnumerable source) { Check.Source(source); return source.SumNullable(new int?(0), (int? total, int? element) => (element == null) ? total : ((total == null || element == null) ? null : new int?(checked(total.Value + element.Value)))); } /// Computes the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// The sum of the projected values. /// A sequence of values that are used to calculate a sum. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// The sum is larger than . // Token: 0x06000323 RID: 803 RVA: 0x0000FC6C File Offset: 0x0000DE6C public static int Sum(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); int num = 0; checked { foreach (TSource tsource in source) { num += selector(tsource); } return num; } } /// Computes the sum of the sequence of nullable values that are obtained by invoking a transform function on each element of the input sequence. /// The sum of the projected values. /// A sequence of values that are used to calculate a sum. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// The sum is larger than . // Token: 0x06000324 RID: 804 RVA: 0x0000FCD8 File Offset: 0x0000DED8 public static int? Sum(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return source.SumNullable(new int?(0), delegate(int? a, TSource b) { int? num = selector(b); return (num == null) ? a : ((a == null) ? null : new int?(checked(a.Value + num.Value))); }); } /// Computes the sum of a sequence of values. /// The sum of the values in the sequence. /// A sequence of values to calculate the sum of. /// /// is null. /// The sum is larger than . // Token: 0x06000325 RID: 805 RVA: 0x0000FD18 File Offset: 0x0000DF18 public static long Sum(this IEnumerable source) { Check.Source(source); return source.Sum((long a, long b) => checked(a + b)); } /// Computes the sum of a sequence of nullable values. /// The sum of the values in the sequence. /// A sequence of nullable values to calculate the sum of. /// /// is null. /// The sum is larger than . // Token: 0x06000326 RID: 806 RVA: 0x0000FD44 File Offset: 0x0000DF44 public static long? Sum(this IEnumerable source) { Check.Source(source); return source.SumNullable(new long?(0L), (long? total, long? element) => (element == null) ? total : ((total == null || element == null) ? null : new long?(checked(total.Value + element.Value)))); } /// Computes the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// The sum of the projected values. /// A sequence of values that are used to calculate a sum. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// The sum is larger than . // Token: 0x06000327 RID: 807 RVA: 0x0000FD84 File Offset: 0x0000DF84 public static long Sum(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); long num = 0L; checked { foreach (TSource tsource in source) { num += selector(tsource); } return num; } } /// Computes the sum of the sequence of nullable values that are obtained by invoking a transform function on each element of the input sequence. /// The sum of the projected values. /// A sequence of values that are used to calculate a sum. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// The sum is larger than . // Token: 0x06000328 RID: 808 RVA: 0x0000FDF0 File Offset: 0x0000DFF0 public static long? Sum(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return source.SumNullable(new long?(0L), delegate(long? a, TSource b) { long? num = selector(b); return (num == null) ? a : ((a == null) ? null : new long?(checked(a.Value + num.Value))); }); } /// Computes the sum of a sequence of values. /// The sum of the values in the sequence. /// A sequence of values to calculate the sum of. /// /// is null. // Token: 0x06000329 RID: 809 RVA: 0x0000FE30 File Offset: 0x0000E030 public static double Sum(this IEnumerable source) { Check.Source(source); return source.Sum((double a, double b) => a + b); } /// Computes the sum of a sequence of nullable values. /// The sum of the values in the sequence. /// A sequence of nullable values to calculate the sum of. /// /// is null. // Token: 0x0600032A RID: 810 RVA: 0x0000FE5C File Offset: 0x0000E05C public static double? Sum(this IEnumerable source) { Check.Source(source); return source.SumNullable(new double?(0.0), (double? total, double? element) => (element == null) ? total : ((total == null || element == null) ? null : new double?(total.Value + element.Value))); } /// Computes the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// The sum of the projected values. /// A sequence of values that are used to calculate a sum. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x0600032B RID: 811 RVA: 0x0000FE98 File Offset: 0x0000E098 public static double Sum(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); double num = 0.0; foreach (TSource tsource in source) { num += selector(tsource); } return num; } /// Computes the sum of the sequence of nullable values that are obtained by invoking a transform function on each element of the input sequence. /// The sum of the projected values. /// A sequence of values that are used to calculate a sum. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x0600032C RID: 812 RVA: 0x0000FF0C File Offset: 0x0000E10C public static double? Sum(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return source.SumNullable(new double?(0.0), delegate(double? a, TSource b) { double? num = selector(b); return (num == null) ? a : ((a == null) ? null : new double?(a.Value + num.Value)); }); } /// Computes the sum of a sequence of values. /// The sum of the values in the sequence. /// A sequence of values to calculate the sum of. /// /// is null. // Token: 0x0600032D RID: 813 RVA: 0x0000FF54 File Offset: 0x0000E154 public static float Sum(this IEnumerable source) { Check.Source(source); return source.Sum((float a, float b) => a + b); } /// Computes the sum of a sequence of nullable values. /// The sum of the values in the sequence. /// A sequence of nullable values to calculate the sum of. /// /// is null. // Token: 0x0600032E RID: 814 RVA: 0x0000FF80 File Offset: 0x0000E180 public static float? Sum(this IEnumerable source) { Check.Source(source); return source.SumNullable(new float?(0f), (float? total, float? element) => (element == null) ? total : ((total == null || element == null) ? null : new float?(total.Value + element.Value))); } /// Computes the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// The sum of the projected values. /// A sequence of values that are used to calculate a sum. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x0600032F RID: 815 RVA: 0x0000FFB8 File Offset: 0x0000E1B8 public static float Sum(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); float num = 0f; foreach (TSource tsource in source) { num += selector(tsource); } return num; } /// Computes the sum of the sequence of nullable values that are obtained by invoking a transform function on each element of the input sequence. /// The sum of the projected values. /// A sequence of values that are used to calculate a sum. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. // Token: 0x06000330 RID: 816 RVA: 0x00010028 File Offset: 0x0000E228 public static float? Sum(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return source.SumNullable(new float?(0f), delegate(float? a, TSource b) { float? num = selector(b); return (num == null) ? a : ((a == null) ? null : new float?(a.Value + num.Value)); }); } /// Computes the sum of a sequence of values. /// The sum of the values in the sequence. /// A sequence of values to calculate the sum of. /// /// is null. /// The sum is larger than . // Token: 0x06000331 RID: 817 RVA: 0x0001006C File Offset: 0x0000E26C public static decimal Sum(this IEnumerable source) { Check.Source(source); return source.Sum((decimal a, decimal b) => a + b); } /// Computes the sum of a sequence of nullable values. /// The sum of the values in the sequence. /// A sequence of nullable values to calculate the sum of. /// /// is null. /// The sum is larger than . // Token: 0x06000332 RID: 818 RVA: 0x00010098 File Offset: 0x0000E298 public static decimal? Sum(this IEnumerable source) { Check.Source(source); return source.SumNullable(new decimal?(0m), (decimal? total, decimal? element) => (element == null) ? total : ((total == null || element == null) ? null : new decimal?(total.Value + element.Value))); } /// Computes the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence. /// The sum of the projected values. /// A sequence of values that are used to calculate a sum. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// The sum is larger than . // Token: 0x06000333 RID: 819 RVA: 0x000100DC File Offset: 0x0000E2DC public static decimal Sum(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); decimal num = 0m; foreach (TSource tsource in source) { num += selector(tsource); } return num; } /// Computes the sum of the sequence of nullable values that are obtained by invoking a transform function on each element of the input sequence. /// The sum of the projected values. /// A sequence of values that are used to calculate a sum. /// A transform function to apply to each element. /// The type of the elements of . /// /// or is null. /// The sum is larger than . // Token: 0x06000334 RID: 820 RVA: 0x00010150 File Offset: 0x0000E350 public static decimal? Sum(this IEnumerable source, Func selector) { Check.SourceAndSelector(source, selector); return source.SumNullable(new decimal?(0m), delegate(decimal? a, TSource b) { decimal? num = selector(b); return (num == null) ? a : ((a == null) ? null : new decimal?(a.Value + num.Value)); }); } // Token: 0x06000335 RID: 821 RVA: 0x00010194 File Offset: 0x0000E394 private static TR Sum(this IEnumerable source, Func selector) { TR tr = default(TR); long num = 0L; foreach (TA ta in source) { tr = selector(tr, ta); num += 1L; } return tr; } // Token: 0x06000336 RID: 822 RVA: 0x00010208 File Offset: 0x0000E408 private static TR SumNullable(this IEnumerable source, TR zero, Func selector) { TR tr = zero; foreach (TA ta in source) { tr = selector(tr, ta); } return tr; } /// Returns a specified number of contiguous elements from the start of a sequence. /// An that contains the specified number of elements from the start of the input sequence. /// The sequence to return elements from. /// The number of elements to return. /// The type of the elements of . /// /// is null. // Token: 0x06000337 RID: 823 RVA: 0x0001026C File Offset: 0x0000E46C public static IEnumerable Take(this IEnumerable source, int count) { Check.Source(source); return Enumerable.CreateTakeIterator(source, count); } // Token: 0x06000338 RID: 824 RVA: 0x0001027C File Offset: 0x0000E47C private static IEnumerable CreateTakeIterator(IEnumerable source, int count) { if (count <= 0) { yield break; } int counter = 0; foreach (TSource element in source) { yield return element; if (++counter == count) { yield break; } } yield break; } /// Returns elements from a sequence as long as a specified condition is true. /// An that contains the elements from the input sequence that occur before the element at which the test no longer passes. /// A sequence to return elements from. /// A function to test each element for a condition. /// The type of the elements of . /// /// or is null. // Token: 0x06000339 RID: 825 RVA: 0x000102B4 File Offset: 0x0000E4B4 public static IEnumerable TakeWhile(this IEnumerable source, Func predicate) { Check.SourceAndPredicate(source, predicate); return Enumerable.CreateTakeWhileIterator(source, predicate); } // Token: 0x0600033A RID: 826 RVA: 0x000102C4 File Offset: 0x0000E4C4 private static IEnumerable CreateTakeWhileIterator(IEnumerable source, Func predicate) { foreach (TSource element in source) { if (!predicate(element)) { yield break; } yield return element; } yield break; } /// Returns elements from a sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function. /// An that contains elements from the input sequence that occur before the element at which the test no longer passes. /// The sequence to return elements from. /// A function to test each source element for a condition; the second parameter of the function represents the index of the source element. /// The type of the elements of . /// /// or is null. // Token: 0x0600033B RID: 827 RVA: 0x000102FC File Offset: 0x0000E4FC public static IEnumerable TakeWhile(this IEnumerable source, Func predicate) { Check.SourceAndPredicate(source, predicate); return Enumerable.CreateTakeWhileIterator(source, predicate); } // Token: 0x0600033C RID: 828 RVA: 0x0001030C File Offset: 0x0000E50C private static IEnumerable CreateTakeWhileIterator(IEnumerable source, Func predicate) { int counter = 0; foreach (TSource element in source) { if (!predicate(element, counter)) { yield break; } yield return element; counter++; } yield break; } /// Performs a subsequent ordering of the elements in a sequence in ascending order according to a key. /// An whose elements are sorted according to a key. /// An that contains elements to sort. /// A function to extract a key from each element. /// The type of the elements of . /// The type of the key returned by . /// /// or is null. // Token: 0x0600033D RID: 829 RVA: 0x00010344 File Offset: 0x0000E544 public static IOrderedEnumerable ThenBy(this IOrderedEnumerable source, Func keySelector) { return source.ThenBy(keySelector, null); } /// Performs a subsequent ordering of the elements in a sequence in ascending order by using a specified comparer. /// An whose elements are sorted according to a key. /// An that contains elements to sort. /// A function to extract a key from each element. /// An to compare keys. /// The type of the elements of . /// The type of the key returned by . /// /// or is null. // Token: 0x0600033E RID: 830 RVA: 0x00010350 File Offset: 0x0000E550 public static IOrderedEnumerable ThenBy(this IOrderedEnumerable source, Func keySelector, IComparer comparer) { Check.SourceAndKeySelector(source, keySelector); return source.CreateOrderedEnumerable(keySelector, comparer, false); } /// Performs a subsequent ordering of the elements in a sequence in descending order, according to a key. /// An whose elements are sorted in descending order according to a key. /// An that contains elements to sort. /// A function to extract a key from each element. /// The type of the elements of . /// The type of the key returned by . /// /// or is null. // Token: 0x0600033F RID: 831 RVA: 0x00010364 File Offset: 0x0000E564 public static IOrderedEnumerable ThenByDescending(this IOrderedEnumerable source, Func keySelector) { return source.ThenByDescending(keySelector, null); } /// Performs a subsequent ordering of the elements in a sequence in descending order by using a specified comparer. /// An whose elements are sorted in descending order according to a key. /// An that contains elements to sort. /// A function to extract a key from each element. /// An to compare keys. /// The type of the elements of . /// The type of the key returned by . /// /// or is null. // Token: 0x06000340 RID: 832 RVA: 0x00010370 File Offset: 0x0000E570 public static IOrderedEnumerable ThenByDescending(this IOrderedEnumerable source, Func keySelector, IComparer comparer) { Check.SourceAndKeySelector(source, keySelector); return source.CreateOrderedEnumerable(keySelector, comparer, true); } /// Creates an array from a . /// An array that contains the elements from the input sequence. /// An to create an array from. /// The type of the elements of . /// /// is null. // Token: 0x06000341 RID: 833 RVA: 0x00010384 File Offset: 0x0000E584 public static TSource[] ToArray(this IEnumerable source) { Check.Source(source); ICollection collection = source as ICollection; if (collection != null) { TSource[] array = new TSource[collection.Count]; collection.CopyTo(array, 0); return array; } return new List(source).ToArray(); } /// Creates a from an according to specified key selector and element selector functions. /// A that contains values of type selected from the input sequence. /// An to create a from. /// A function to extract a key from each element. /// A transform function to produce a result element value from each element. /// The type of the elements of . /// The type of the key returned by . /// The type of the value returned by . /// /// or or is null.-or- produces a key that is null. /// /// produces duplicate keys for two elements. // Token: 0x06000342 RID: 834 RVA: 0x000103C8 File Offset: 0x0000E5C8 public static Dictionary ToDictionary(this IEnumerable source, Func keySelector, Func elementSelector) { return source.ToDictionary(keySelector, elementSelector, null); } /// Creates a from an according to a specified key selector function, a comparer, and an element selector function. /// A that contains values of type selected from the input sequence. /// An to create a from. /// A function to extract a key from each element. /// A transform function to produce a result element value from each element. /// An to compare keys. /// The type of the elements of . /// The type of the key returned by . /// The type of the value returned by . /// /// or or is null.-or- produces a key that is null. /// /// produces duplicate keys for two elements. // Token: 0x06000343 RID: 835 RVA: 0x000103D4 File Offset: 0x0000E5D4 public static Dictionary ToDictionary(this IEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer comparer) { Check.SourceAndKeyElementSelectors(source, keySelector, elementSelector); if (comparer == null) { comparer = EqualityComparer.Default; } Dictionary dictionary = new Dictionary(comparer); foreach (TSource tsource in source) { dictionary.Add(keySelector(tsource), elementSelector(tsource)); } return dictionary; } /// Creates a from an according to a specified key selector function. /// A that contains keys and values. /// An to create a from. /// A function to extract a key from each element. /// The type of the elements of . /// The type of the key returned by . /// /// or is null.-or- produces a key that is null. /// /// produces duplicate keys for two elements. // Token: 0x06000344 RID: 836 RVA: 0x0001045C File Offset: 0x0000E65C public static Dictionary ToDictionary(this IEnumerable source, Func keySelector) { return source.ToDictionary(keySelector, null); } /// Creates a from an according to a specified key selector function and key comparer. /// A that contains keys and values. /// An to create a from. /// A function to extract a key from each element. /// An to compare keys. /// The type of the elements of . /// The type of the keys returned by . /// /// or is null.-or- produces a key that is null. /// /// produces duplicate keys for two elements. // Token: 0x06000345 RID: 837 RVA: 0x00010468 File Offset: 0x0000E668 public static Dictionary ToDictionary(this IEnumerable source, Func keySelector, IEqualityComparer comparer) { return source.ToDictionary(keySelector, Enumerable.Function.Identity, comparer); } /// Creates a from an . /// A that contains elements from the input sequence. /// The to create a from. /// The type of the elements of . /// /// is null. // Token: 0x06000346 RID: 838 RVA: 0x00010478 File Offset: 0x0000E678 public static List ToList(this IEnumerable source) { Check.Source(source); return new List(source); } /// Creates a from an according to a specified key selector function. /// A that contains keys and values. /// The to create a from. /// A function to extract a key from each element. /// The type of the elements of . /// The type of the key returned by . /// /// or is null. // Token: 0x06000347 RID: 839 RVA: 0x00010488 File Offset: 0x0000E688 public static ILookup ToLookup(this IEnumerable source, Func keySelector) { return source.ToLookup(keySelector, Enumerable.Function.Identity, null); } /// Creates a from an according to a specified key selector function and key comparer. /// A that contains keys and values. /// The to create a from. /// A function to extract a key from each element. /// An to compare keys. /// The type of the elements of . /// The type of the key returned by . /// /// or is null. // Token: 0x06000348 RID: 840 RVA: 0x00010498 File Offset: 0x0000E698 public static ILookup ToLookup(this IEnumerable source, Func keySelector, IEqualityComparer comparer) { return source.ToLookup(keySelector, (TSource element) => element, comparer); } /// Creates a from an according to specified key selector and element selector functions. /// A that contains values of type selected from the input sequence. /// The to create a from. /// A function to extract a key from each element. /// A transform function to produce a result element value from each element. /// The type of the elements of . /// The type of the key returned by . /// The type of the value returned by . /// /// or or is null. // Token: 0x06000349 RID: 841 RVA: 0x000104B0 File Offset: 0x0000E6B0 public static ILookup ToLookup(this IEnumerable source, Func keySelector, Func elementSelector) { return source.ToLookup(keySelector, elementSelector, null); } /// Creates a from an according to a specified key selector function, a comparer and an element selector function. /// A that contains values of type selected from the input sequence. /// The to create a from. /// A function to extract a key from each element. /// A transform function to produce a result element value from each element. /// An to compare keys. /// The type of the elements of . /// The type of the key returned by . /// The type of the value returned by . /// /// or or is null. // Token: 0x0600034A RID: 842 RVA: 0x000104BC File Offset: 0x0000E6BC public static ILookup ToLookup(this IEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer comparer) { Check.SourceAndKeyElementSelectors(source, keySelector, elementSelector); List list = null; Dictionary> dictionary = new Dictionary>(comparer ?? EqualityComparer.Default); foreach (TSource tsource in source) { TKey tkey = keySelector(tsource); List list2; if (tkey == null) { if (list == null) { list = new List(); } list2 = list; } else if (!dictionary.TryGetValue(tkey, out list2)) { list2 = new List(); dictionary.Add(tkey, list2); } list2.Add(elementSelector(tsource)); } return new Lookup(dictionary, list); } /// Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type. /// true if the two source sequences are of equal length and their corresponding elements are equal according to the default equality comparer for their type; otherwise, false. /// An to compare to . /// An to compare to the first sequence. /// The type of the elements of the input sequences. /// /// or is null. // Token: 0x0600034B RID: 843 RVA: 0x00010590 File Offset: 0x0000E790 public static bool SequenceEqual(this IEnumerable first, IEnumerable second) { return first.SequenceEqual(second, null); } /// Determines whether two sequences are equal by comparing their elements by using a specified . /// true if the two source sequences are of equal length and their corresponding elements compare equal according to ; otherwise, false. /// An to compare to . /// An to compare to the first sequence. /// An to use to compare elements. /// The type of the elements of the input sequences. /// /// or is null. // Token: 0x0600034C RID: 844 RVA: 0x0001059C File Offset: 0x0000E79C public static bool SequenceEqual(this IEnumerable first, IEnumerable second, IEqualityComparer comparer) { Check.FirstAndSecond(first, second); if (comparer == null) { comparer = EqualityComparer.Default; } bool flag; using (IEnumerator enumerator = first.GetEnumerator()) { using (IEnumerator enumerator2 = second.GetEnumerator()) { while (enumerator.MoveNext()) { if (!enumerator2.MoveNext()) { return false; } if (!comparer.Equals(enumerator.Current, enumerator2.Current)) { return false; } } flag = !enumerator2.MoveNext(); } } return flag; } /// Produces the union of two sequences by using the default equality comparer. /// An that contains the elements from both input sequences, excluding duplicates. /// An whose distinct elements form the first set for the union. /// An whose distinct elements form the second set for the union. /// The type of the elements of the input sequences. /// /// or is null. // Token: 0x0600034D RID: 845 RVA: 0x00010674 File Offset: 0x0000E874 public static IEnumerable Union(this IEnumerable first, IEnumerable second) { Check.FirstAndSecond(first, second); return first.Union(second, null); } /// Produces the set union of two sequences by using a specified . /// An that contains the elements from both input sequences, excluding duplicates. /// An whose distinct elements form the first set for the union. /// An whose distinct elements form the second set for the union. /// The to compare values. /// The type of the elements of the input sequences. /// /// or is null. // Token: 0x0600034E RID: 846 RVA: 0x00010688 File Offset: 0x0000E888 public static IEnumerable Union(this IEnumerable first, IEnumerable second, IEqualityComparer comparer) { Check.FirstAndSecond(first, second); if (comparer == null) { comparer = EqualityComparer.Default; } return Enumerable.CreateUnionIterator(first, second, comparer); } // Token: 0x0600034F RID: 847 RVA: 0x000106A8 File Offset: 0x0000E8A8 private static IEnumerable CreateUnionIterator(IEnumerable first, IEnumerable second, IEqualityComparer comparer) { HashSet items = new HashSet(comparer); foreach (TSource element in first) { if (!items.Contains(element)) { items.Add(element); yield return element; } } foreach (TSource element2 in second) { if (!items.Contains(element2, comparer)) { items.Add(element2); yield return element2; } } yield break; } /// Filters a sequence of values based on a predicate. /// An that contains elements from the input sequence that satisfy the condition. /// An to filter. /// A function to test each element for a condition. /// The type of the elements of . /// /// or is null. // Token: 0x06000350 RID: 848 RVA: 0x000106F0 File Offset: 0x0000E8F0 public static IEnumerable Where(this IEnumerable source, Func predicate) { Check.SourceAndPredicate(source, predicate); return Enumerable.CreateWhereIterator(source, predicate); } // Token: 0x06000351 RID: 849 RVA: 0x00010700 File Offset: 0x0000E900 private static IEnumerable CreateWhereIterator(IEnumerable source, Func predicate) { foreach (TSource element in source) { if (predicate(element)) { yield return element; } } yield break; } /// Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function. /// An that contains elements from the input sequence that satisfy the condition. /// An to filter. /// A function to test each source element for a condition; the second parameter of the function represents the index of the source element. /// The type of the elements of . /// /// or is null. // Token: 0x06000352 RID: 850 RVA: 0x00010738 File Offset: 0x0000E938 public static IEnumerable Where(this IEnumerable source, Func predicate) { Check.SourceAndPredicate(source, predicate); return source.CreateWhereIterator(predicate); } // Token: 0x06000353 RID: 851 RVA: 0x00010748 File Offset: 0x0000E948 private static IEnumerable CreateWhereIterator(this IEnumerable source, Func predicate) { int counter = 0; foreach (TSource element in source) { if (predicate(element, counter)) { yield return element; } counter++; } yield break; } // Token: 0x06000354 RID: 852 RVA: 0x00010780 File Offset: 0x0000E980 internal static ReadOnlyCollection ToReadOnlyCollection(this IEnumerable source) { if (source == null) { return Enumerable.ReadOnlyCollectionOf.Empty; } ReadOnlyCollection readOnlyCollection = source as ReadOnlyCollection; if (readOnlyCollection != null) { return readOnlyCollection; } return new ReadOnlyCollection(source.ToArray()); } // Token: 0x02000033 RID: 51 private enum Fallback { // Token: 0x040000E2 RID: 226 Default, // Token: 0x040000E3 RID: 227 Throw } // Token: 0x02000034 RID: 52 private class Function { // Token: 0x040000E4 RID: 228 public static readonly Func Identity = (T t) => t; } // Token: 0x02000035 RID: 53 private class ReadOnlyCollectionOf { // Token: 0x040000E6 RID: 230 public static readonly ReadOnlyCollection Empty = new ReadOnlyCollection(new T[0]); } } }