scripts
This commit is contained in:
@@ -0,0 +1,226 @@
|
||||
using System;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
// Token: 0x02000031 RID: 49
|
||||
internal static class Check
|
||||
{
|
||||
// Token: 0x0600026D RID: 621 RVA: 0x0000CB38 File Offset: 0x0000AD38
|
||||
public static void Source(object source)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600026E RID: 622 RVA: 0x0000CB4C File Offset: 0x0000AD4C
|
||||
public static void Source1AndSource2(object source1, object source2)
|
||||
{
|
||||
if (source1 == null)
|
||||
{
|
||||
throw new ArgumentNullException("source1");
|
||||
}
|
||||
if (source2 == null)
|
||||
{
|
||||
throw new ArgumentNullException("source2");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600026F RID: 623 RVA: 0x0000CB7C File Offset: 0x0000AD7C
|
||||
public static void SourceAndFuncAndSelector(object source, object func, object selector)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
if (func == null)
|
||||
{
|
||||
throw new ArgumentNullException("func");
|
||||
}
|
||||
if (selector == null)
|
||||
{
|
||||
throw new ArgumentNullException("selector");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000270 RID: 624 RVA: 0x0000CBB4 File Offset: 0x0000ADB4
|
||||
public static void SourceAndFunc(object source, object func)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
if (func == null)
|
||||
{
|
||||
throw new ArgumentNullException("func");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000271 RID: 625 RVA: 0x0000CBE4 File Offset: 0x0000ADE4
|
||||
public static void SourceAndSelector(object source, object selector)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
if (selector == null)
|
||||
{
|
||||
throw new ArgumentNullException("selector");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000272 RID: 626 RVA: 0x0000CC14 File Offset: 0x0000AE14
|
||||
public static void SourceAndPredicate(object source, object predicate)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
if (predicate == null)
|
||||
{
|
||||
throw new ArgumentNullException("predicate");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000273 RID: 627 RVA: 0x0000CC44 File Offset: 0x0000AE44
|
||||
public static void FirstAndSecond(object first, object second)
|
||||
{
|
||||
if (first == null)
|
||||
{
|
||||
throw new ArgumentNullException("first");
|
||||
}
|
||||
if (second == null)
|
||||
{
|
||||
throw new ArgumentNullException("second");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000274 RID: 628 RVA: 0x0000CC74 File Offset: 0x0000AE74
|
||||
public static void SourceAndKeySelector(object source, object keySelector)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
if (keySelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("keySelector");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000275 RID: 629 RVA: 0x0000CCA4 File Offset: 0x0000AEA4
|
||||
public static void SourceAndKeyElementSelectors(object source, object keySelector, object elementSelector)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
if (keySelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("keySelector");
|
||||
}
|
||||
if (elementSelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("elementSelector");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000276 RID: 630 RVA: 0x0000CCDC File Offset: 0x0000AEDC
|
||||
public static void SourceAndKeyResultSelectors(object source, object keySelector, object resultSelector)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
if (keySelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("keySelector");
|
||||
}
|
||||
if (resultSelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("resultSelector");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000277 RID: 631 RVA: 0x0000CD14 File Offset: 0x0000AF14
|
||||
public static void SourceAndCollectionSelectorAndResultSelector(object source, object collectionSelector, object resultSelector)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
if (collectionSelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("collectionSelector");
|
||||
}
|
||||
if (resultSelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("resultSelector");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000278 RID: 632 RVA: 0x0000CD4C File Offset: 0x0000AF4C
|
||||
public static void SourceAndCollectionSelectors(object source, object collectionSelector, object selector)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
if (collectionSelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("collectionSelector");
|
||||
}
|
||||
if (selector == null)
|
||||
{
|
||||
throw new ArgumentNullException("selector");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000279 RID: 633 RVA: 0x0000CD84 File Offset: 0x0000AF84
|
||||
public static void JoinSelectors(object outer, object inner, object outerKeySelector, object innerKeySelector, object resultSelector)
|
||||
{
|
||||
if (outer == null)
|
||||
{
|
||||
throw new ArgumentNullException("outer");
|
||||
}
|
||||
if (inner == null)
|
||||
{
|
||||
throw new ArgumentNullException("inner");
|
||||
}
|
||||
if (outerKeySelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("outerKeySelector");
|
||||
}
|
||||
if (innerKeySelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("innerKeySelector");
|
||||
}
|
||||
if (resultSelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("resultSelector");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600027A RID: 634 RVA: 0x0000CDE8 File Offset: 0x0000AFE8
|
||||
public static void GroupBySelectors(object source, object keySelector, object elementSelector, object resultSelector)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
if (keySelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("keySelector");
|
||||
}
|
||||
if (elementSelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("elementSelector");
|
||||
}
|
||||
if (resultSelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("resultSelector");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3979 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
/// <summary>Provides a set of static (Shared in Visual Basic) methods for querying objects that implement <see cref="T:System.Collections.Generic.IEnumerable`1" />.</summary>
|
||||
// Token: 0x02000032 RID: 50
|
||||
public static class Enumerable
|
||||
{
|
||||
/// <summary>Applies an accumulator function over a sequence.</summary>
|
||||
/// <returns>The final accumulator value.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to aggregate over.</param>
|
||||
/// <param name="func">An accumulator function to be invoked on each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="func" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x0600027B RID: 635 RVA: 0x0000CE3C File Offset: 0x0000B03C
|
||||
public static TSource Aggregate<TSource>(this IEnumerable<TSource> source, Func<TSource, TSource, TSource> func)
|
||||
{
|
||||
Check.SourceAndFunc(source, func);
|
||||
TSource tsource3;
|
||||
using (IEnumerator<TSource> 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;
|
||||
}
|
||||
|
||||
/// <summary>Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.</summary>
|
||||
/// <returns>The final accumulator value.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to aggregate over.</param>
|
||||
/// <param name="seed">The initial accumulator value.</param>
|
||||
/// <param name="func">An accumulator function to be invoked on each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TAccumulate">The type of the accumulator value.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="func" /> is null.</exception>
|
||||
// Token: 0x0600027C RID: 636 RVA: 0x0000CEC8 File Offset: 0x0000B0C8
|
||||
public static TAccumulate Aggregate<TSource, TAccumulate>(this IEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func)
|
||||
{
|
||||
Check.SourceAndFunc(source, func);
|
||||
TAccumulate taccumulate = seed;
|
||||
foreach (TSource tsource in source)
|
||||
{
|
||||
taccumulate = func(taccumulate, tsource);
|
||||
}
|
||||
return taccumulate;
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>The transformed final accumulator value.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to aggregate over.</param>
|
||||
/// <param name="seed">The initial accumulator value.</param>
|
||||
/// <param name="func">An accumulator function to be invoked on each element.</param>
|
||||
/// <param name="resultSelector">A function to transform the final accumulator value into the result value.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TAccumulate">The type of the accumulator value.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the resulting value.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="func" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x0600027D RID: 637 RVA: 0x0000CF34 File Offset: 0x0000B134
|
||||
public static TResult Aggregate<TSource, TAccumulate, TResult>(this IEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func, Func<TAccumulate, TResult> 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);
|
||||
}
|
||||
|
||||
/// <summary>Determines whether all elements of a sequence satisfy a condition.</summary>
|
||||
/// <returns>true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements to apply the predicate to.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x0600027E RID: 638 RVA: 0x0000CFB8 File Offset: 0x0000B1B8
|
||||
public static bool All<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
foreach (TSource tsource in source)
|
||||
{
|
||||
if (!predicate(tsource))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Determines whether a sequence contains any elements.</summary>
|
||||
/// <returns>true if the source sequence contains any elements; otherwise, false.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to check for emptiness.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x0600027F RID: 639 RVA: 0x0000D02C File Offset: 0x0000B22C
|
||||
public static bool Any<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
ICollection<TSource> collection = source as ICollection<TSource>;
|
||||
if (collection != null)
|
||||
{
|
||||
return collection.Count > 0;
|
||||
}
|
||||
bool flag;
|
||||
using (IEnumerator<TSource> enumerator = source.GetEnumerator())
|
||||
{
|
||||
flag = enumerator.MoveNext();
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/// <summary>Determines whether any element of a sequence satisfies a condition.</summary>
|
||||
/// <returns>true if any elements in the source sequence pass the test in the specified predicate; otherwise, false.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to apply the predicate to.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x06000280 RID: 640 RVA: 0x0000D098 File Offset: 0x0000B298
|
||||
public static bool Any<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
foreach (TSource tsource in source)
|
||||
{
|
||||
if (predicate(tsource))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Returns the input typed as <see cref="T:System.Collections.Generic.IEnumerable`1" />.</summary>
|
||||
/// <returns>The input sequence typed as <see cref="T:System.Collections.Generic.IEnumerable`1" />.</returns>
|
||||
/// <param name="source">The sequence to type as <see cref="T:System.Collections.Generic.IEnumerable`1" />.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
// Token: 0x06000281 RID: 641 RVA: 0x0000D10C File Offset: 0x0000B30C
|
||||
public static IEnumerable<TSource> AsEnumerable<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
return source;
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Int32" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Int32" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum of the elements in the sequence is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x06000282 RID: 642 RVA: 0x0000D110 File Offset: 0x0000B310
|
||||
public static double Average(this IEnumerable<int> 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;
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Int64" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Int64" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum of the elements in the sequence is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x06000283 RID: 643 RVA: 0x0000D18C File Offset: 0x0000B38C
|
||||
public static double Average(this IEnumerable<long> 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;
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Double" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Double" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x06000284 RID: 644 RVA: 0x0000D20C File Offset: 0x0000B40C
|
||||
public static double Average(this IEnumerable<double> 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;
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Single" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Single" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x06000285 RID: 645 RVA: 0x0000D290 File Offset: 0x0000B490
|
||||
public static float Average(this IEnumerable<float> 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;
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Decimal" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum of the elements in the sequence is larger than <see cref="F:System.Decimal.MaxValue" />.</exception>
|
||||
// Token: 0x06000286 RID: 646 RVA: 0x0000D310 File Offset: 0x0000B510
|
||||
public static decimal Average(this IEnumerable<decimal> 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;
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Int32" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum of the elements in the sequence is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x06000287 RID: 647 RVA: 0x0000D39C File Offset: 0x0000B59C
|
||||
public static double? Average(this IEnumerable<int?> 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);
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Int64" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum of the elements in the sequence is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x06000288 RID: 648 RVA: 0x0000D43C File Offset: 0x0000B63C
|
||||
public static double? Average(this IEnumerable<long?> 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);
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Double" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x06000289 RID: 649 RVA: 0x0000D4DC File Offset: 0x0000B6DC
|
||||
public static double? Average(this IEnumerable<double?> 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);
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Decimal" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum of the elements in the sequence is larger than <see cref="F:System.Decimal.MaxValue" />.</exception>
|
||||
// Token: 0x0600028A RID: 650 RVA: 0x0000D580 File Offset: 0x0000B780
|
||||
public static decimal? Average(this IEnumerable<decimal?> 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);
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Single" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x0600028B RID: 651 RVA: 0x0000D630 File Offset: 0x0000B830
|
||||
public static float? Average(this IEnumerable<float?> 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);
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum of the elements in the sequence is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x0600028C RID: 652 RVA: 0x0000D6D0 File Offset: 0x0000B8D0
|
||||
public static double Average<TSource>(this IEnumerable<TSource> source, Func<TSource, int> 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;
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum of the elements in the sequence is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x0600028D RID: 653 RVA: 0x0000D758 File Offset: 0x0000B958
|
||||
public static double? Average<TSource>(this IEnumerable<TSource> source, Func<TSource, int?> 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);
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of source.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum of the elements in the sequence is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x0600028E RID: 654 RVA: 0x0000D804 File Offset: 0x0000BA04
|
||||
public static double Average<TSource>(this IEnumerable<TSource> source, Func<TSource, long> 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;
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
// Token: 0x0600028F RID: 655 RVA: 0x0000D888 File Offset: 0x0000BA88
|
||||
public static double? Average<TSource>(this IEnumerable<TSource> source, Func<TSource, long?> 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);
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x06000290 RID: 656 RVA: 0x0000D930 File Offset: 0x0000BB30
|
||||
public static double Average<TSource>(this IEnumerable<TSource> source, Func<TSource, double> 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;
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x06000291 RID: 657 RVA: 0x0000D9BC File Offset: 0x0000BBBC
|
||||
public static double? Average<TSource>(this IEnumerable<TSource> source, Func<TSource, double?> 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);
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x06000292 RID: 658 RVA: 0x0000DA6C File Offset: 0x0000BC6C
|
||||
public static float Average<TSource>(this IEnumerable<TSource> source, Func<TSource, float> 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;
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x06000293 RID: 659 RVA: 0x0000DAF4 File Offset: 0x0000BCF4
|
||||
public static float? Average<TSource>(this IEnumerable<TSource> source, Func<TSource, float?> 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);
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of values that are used to calculate an average.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum of the elements in the sequence is larger than <see cref="F:System.Decimal.MaxValue" />.</exception>
|
||||
// Token: 0x06000294 RID: 660 RVA: 0x0000DBA0 File Offset: 0x0000BDA0
|
||||
public static decimal Average<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal> 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;
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only values that are null.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum of the elements in the sequence is larger than <see cref="F:System.Decimal.MaxValue" />.</exception>
|
||||
// Token: 0x06000295 RID: 661 RVA: 0x0000DC34 File Offset: 0x0000BE34
|
||||
public static decimal? Average<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal?> 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);
|
||||
}
|
||||
|
||||
/// <summary>Converts the elements of an <see cref="T:System.Collections.IEnumerable" /> to the specified type.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains each element of the source sequence converted to the specified type.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Collections.IEnumerable" /> that contains the elements to be converted.</param>
|
||||
/// <typeparam name="TResult">The type to convert the elements of <paramref name="source" /> to.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidCastException">An element in the sequence cannot be cast to type <paramref name="TResult" />.</exception>
|
||||
// Token: 0x06000296 RID: 662 RVA: 0x0000DCEC File Offset: 0x0000BEEC
|
||||
public static IEnumerable<TResult> Cast<TResult>(this IEnumerable source)
|
||||
{
|
||||
Check.Source(source);
|
||||
IEnumerable<TResult> enumerable = source as IEnumerable<TResult>;
|
||||
if (enumerable != null)
|
||||
{
|
||||
return enumerable;
|
||||
}
|
||||
return Enumerable.CreateCastIterator<TResult>(source);
|
||||
}
|
||||
|
||||
// Token: 0x06000297 RID: 663 RVA: 0x0000DD14 File Offset: 0x0000BF14
|
||||
private static IEnumerable<TResult> CreateCastIterator<TResult>(IEnumerable source)
|
||||
{
|
||||
foreach (object obj in source)
|
||||
{
|
||||
TResult element = (TResult)((object)obj);
|
||||
yield return element;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Concatenates two sequences.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the concatenated elements of the two input sequences.</returns>
|
||||
/// <param name="first">The first sequence to concatenate.</param>
|
||||
/// <param name="second">The sequence to concatenate to the first sequence.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
|
||||
// Token: 0x06000298 RID: 664 RVA: 0x0000DD40 File Offset: 0x0000BF40
|
||||
public static IEnumerable<TSource> Concat<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second)
|
||||
{
|
||||
Check.FirstAndSecond(first, second);
|
||||
return Enumerable.CreateConcatIterator<TSource>(first, second);
|
||||
}
|
||||
|
||||
// Token: 0x06000299 RID: 665 RVA: 0x0000DD50 File Offset: 0x0000BF50
|
||||
private static IEnumerable<TSource> CreateConcatIterator<TSource>(IEnumerable<TSource> first, IEnumerable<TSource> second)
|
||||
{
|
||||
foreach (TSource element in first)
|
||||
{
|
||||
yield return element;
|
||||
}
|
||||
foreach (TSource element2 in second)
|
||||
{
|
||||
yield return element2;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Determines whether a sequence contains a specified element by using the default equality comparer.</summary>
|
||||
/// <returns>true if the source sequence contains an element that has the specified value; otherwise, false.</returns>
|
||||
/// <param name="source">A sequence in which to locate a value.</param>
|
||||
/// <param name="value">The value to locate in the sequence.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x0600029A RID: 666 RVA: 0x0000DD88 File Offset: 0x0000BF88
|
||||
public static bool Contains<TSource>(this IEnumerable<TSource> source, TSource value)
|
||||
{
|
||||
ICollection<TSource> collection = source as ICollection<TSource>;
|
||||
if (collection != null)
|
||||
{
|
||||
return collection.Contains(value);
|
||||
}
|
||||
return source.Contains(value, null);
|
||||
}
|
||||
|
||||
/// <summary>Determines whether a sequence contains a specified element by using a specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" />.</summary>
|
||||
/// <returns>true if the source sequence contains an element that has the specified value; otherwise, false.</returns>
|
||||
/// <param name="source">A sequence in which to locate a value.</param>
|
||||
/// <param name="value">The value to locate in the sequence.</param>
|
||||
/// <param name="comparer">An equality comparer to compare values.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x0600029B RID: 667 RVA: 0x0000DDB4 File Offset: 0x0000BFB4
|
||||
public static bool Contains<TSource>(this IEnumerable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
Check.Source(source);
|
||||
if (comparer == null)
|
||||
{
|
||||
comparer = EqualityComparer<TSource>.Default;
|
||||
}
|
||||
foreach (TSource tsource in source)
|
||||
{
|
||||
if (comparer.Equals(tsource, value))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Returns the number of elements in a sequence.</summary>
|
||||
/// <returns>The number of elements in the input sequence.</returns>
|
||||
/// <param name="source">A sequence that contains elements to be counted.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The number of elements in <paramref name="source" /> is larger than <see cref="F:System.Int32.MaxValue" />.</exception>
|
||||
// Token: 0x0600029C RID: 668 RVA: 0x0000DE38 File Offset: 0x0000C038
|
||||
public static int Count<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
ICollection<TSource> collection = source as ICollection<TSource>;
|
||||
if (collection != null)
|
||||
{
|
||||
return collection.Count;
|
||||
}
|
||||
int num = 0;
|
||||
using (IEnumerator<TSource> enumerator = source.GetEnumerator())
|
||||
{
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Returns a number that represents how many elements in the specified sequence satisfy a condition.</summary>
|
||||
/// <returns>A number that represents how many elements in the sequence satisfy the condition in the predicate function.</returns>
|
||||
/// <param name="source">A sequence that contains elements to be tested and counted.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The number of elements in <paramref name="source" /> is larger than <see cref="F:System.Int32.MaxValue" />.</exception>
|
||||
// Token: 0x0600029D RID: 669 RVA: 0x0000DEAC File Offset: 0x0000C0AC
|
||||
public static int Count<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
int num = 0;
|
||||
foreach (TSource tsource in source)
|
||||
{
|
||||
if (selector(tsource))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> object that contains the default value for the <paramref name="TSource" /> type if <paramref name="source" /> is empty; otherwise, <paramref name="source" />.</returns>
|
||||
/// <param name="source">The sequence to return a default value for if it is empty.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x0600029E RID: 670 RVA: 0x0000DF20 File Offset: 0x0000C120
|
||||
public static IEnumerable<TSource> DefaultIfEmpty<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
return source.DefaultIfEmpty(default(TSource));
|
||||
}
|
||||
|
||||
/// <summary>Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <paramref name="defaultValue" /> if <paramref name="source" /> is empty; otherwise, <paramref name="source" />.</returns>
|
||||
/// <param name="source">The sequence to return the specified value for if it is empty.</param>
|
||||
/// <param name="defaultValue">The value to return if the sequence is empty.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
// Token: 0x0600029F RID: 671 RVA: 0x0000DF3C File Offset: 0x0000C13C
|
||||
public static IEnumerable<TSource> DefaultIfEmpty<TSource>(this IEnumerable<TSource> source, TSource defaultValue)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.CreateDefaultIfEmptyIterator<TSource>(source, defaultValue);
|
||||
}
|
||||
|
||||
// Token: 0x060002A0 RID: 672 RVA: 0x0000DF4C File Offset: 0x0000C14C
|
||||
private static IEnumerable<TSource> CreateDefaultIfEmptyIterator<TSource>(IEnumerable<TSource> source, TSource defaultValue)
|
||||
{
|
||||
bool empty = true;
|
||||
foreach (TSource item in source)
|
||||
{
|
||||
empty = false;
|
||||
yield return item;
|
||||
}
|
||||
if (empty)
|
||||
{
|
||||
yield return defaultValue;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Returns distinct elements from a sequence by using the default equality comparer to compare values.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains distinct elements from the source sequence.</returns>
|
||||
/// <param name="source">The sequence to remove duplicate elements from.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002A1 RID: 673 RVA: 0x0000DF84 File Offset: 0x0000C184
|
||||
public static IEnumerable<TSource> Distinct<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
return source.Distinct(null);
|
||||
}
|
||||
|
||||
/// <summary>Returns distinct elements from a sequence by using a specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains distinct elements from the source sequence.</returns>
|
||||
/// <param name="source">The sequence to remove duplicate elements from.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002A2 RID: 674 RVA: 0x0000DF90 File Offset: 0x0000C190
|
||||
public static IEnumerable<TSource> Distinct<TSource>(this IEnumerable<TSource> source, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
Check.Source(source);
|
||||
if (comparer == null)
|
||||
{
|
||||
comparer = EqualityComparer<TSource>.Default;
|
||||
}
|
||||
return Enumerable.CreateDistinctIterator<TSource>(source, comparer);
|
||||
}
|
||||
|
||||
// Token: 0x060002A3 RID: 675 RVA: 0x0000DFAC File Offset: 0x0000C1AC
|
||||
private static IEnumerable<TSource> CreateDistinctIterator<TSource>(IEnumerable<TSource> source, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
HashSet<TSource> items = new HashSet<TSource>(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<TSource>(this IEnumerable<TSource> 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);
|
||||
}
|
||||
|
||||
/// <summary>Returns the element at a specified index in a sequence.</summary>
|
||||
/// <returns>The element at the specified position in the source sequence.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.</param>
|
||||
/// <param name="index">The zero-based index of the element to retrieve.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> is less than 0 or greater than or equal to the number of elements in <paramref name="source" />.</exception>
|
||||
// Token: 0x060002A5 RID: 677 RVA: 0x0000E06C File Offset: 0x0000C26C
|
||||
public static TSource ElementAt<TSource>(this IEnumerable<TSource> source, int index)
|
||||
{
|
||||
Check.Source(source);
|
||||
if (index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
IList<TSource> list = source as IList<TSource>;
|
||||
if (list != null)
|
||||
{
|
||||
return list[index];
|
||||
}
|
||||
return source.ElementAt(index, Enumerable.Fallback.Throw);
|
||||
}
|
||||
|
||||
/// <summary>Returns the element at a specified index in a sequence or a default value if the index is out of range.</summary>
|
||||
/// <returns>default(<paramref name="TSource" />) if the index is outside the bounds of the source sequence; otherwise, the element at the specified position in the source sequence.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.</param>
|
||||
/// <param name="index">The zero-based index of the element to retrieve.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002A6 RID: 678 RVA: 0x0000E0AC File Offset: 0x0000C2AC
|
||||
public static TSource ElementAtOrDefault<TSource>(this IEnumerable<TSource> source, int index)
|
||||
{
|
||||
Check.Source(source);
|
||||
if (index < 0)
|
||||
{
|
||||
return default(TSource);
|
||||
}
|
||||
IList<TSource> list = source as IList<TSource>;
|
||||
if (list != null)
|
||||
{
|
||||
return (index >= list.Count) ? default(TSource) : list[index];
|
||||
}
|
||||
return source.ElementAt(index, Enumerable.Fallback.Default);
|
||||
}
|
||||
|
||||
/// <summary>Returns an empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> that has the specified type argument.</summary>
|
||||
/// <returns>An empty <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose type argument is <paramref name="TResult" />.</returns>
|
||||
/// <typeparam name="TResult">The type to assign to the type parameter of the returned generic <see cref="T:System.Collections.Generic.IEnumerable`1" />.</typeparam>
|
||||
// Token: 0x060002A7 RID: 679 RVA: 0x0000E108 File Offset: 0x0000C308
|
||||
public static IEnumerable<TResult> Empty<TResult>()
|
||||
{
|
||||
return new TResult[0];
|
||||
}
|
||||
|
||||
/// <summary>Produces the set difference of two sequences by using the default equality comparer to compare values.</summary>
|
||||
/// <returns>A sequence that contains the set difference of the elements of two sequences.</returns>
|
||||
/// <param name="first">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements that are not also in <paramref name="second" /> will be returned.</param>
|
||||
/// <param name="second">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
|
||||
// Token: 0x060002A8 RID: 680 RVA: 0x0000E110 File Offset: 0x0000C310
|
||||
public static IEnumerable<TSource> Except<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second)
|
||||
{
|
||||
return first.Except(second, null);
|
||||
}
|
||||
|
||||
/// <summary>Produces the set difference of two sequences by using the specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</summary>
|
||||
/// <returns>A sequence that contains the set difference of the elements of two sequences.</returns>
|
||||
/// <param name="first">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements that are not also in <paramref name="second" /> will be returned.</param>
|
||||
/// <param name="second">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
|
||||
// Token: 0x060002A9 RID: 681 RVA: 0x0000E11C File Offset: 0x0000C31C
|
||||
public static IEnumerable<TSource> Except<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
Check.FirstAndSecond(first, second);
|
||||
if (comparer == null)
|
||||
{
|
||||
comparer = EqualityComparer<TSource>.Default;
|
||||
}
|
||||
return Enumerable.CreateExceptIterator<TSource>(first, second, comparer);
|
||||
}
|
||||
|
||||
// Token: 0x060002AA RID: 682 RVA: 0x0000E13C File Offset: 0x0000C33C
|
||||
private static IEnumerable<TSource> CreateExceptIterator<TSource>(IEnumerable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
HashSet<TSource> items = new HashSet<TSource>(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<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> 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);
|
||||
}
|
||||
|
||||
/// <summary>Returns the first element of a sequence.</summary>
|
||||
/// <returns>The first element in the specified sequence.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the first element of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The source sequence is empty.</exception>
|
||||
// Token: 0x060002AC RID: 684 RVA: 0x0000E208 File Offset: 0x0000C408
|
||||
public static TSource First<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
IList<TSource> list = source as IList<TSource>;
|
||||
if (list == null)
|
||||
{
|
||||
using (IEnumerator<TSource> enumerator = source.GetEnumerator())
|
||||
{
|
||||
if (enumerator.MoveNext())
|
||||
{
|
||||
return enumerator.Current;
|
||||
}
|
||||
}
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
if (list.Count != 0)
|
||||
{
|
||||
return list[0];
|
||||
}
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
/// <summary>Returns the first element in a sequence that satisfies a specified condition.</summary>
|
||||
/// <returns>The first element in the sequence that passes the test in the specified predicate function.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">No element satisfies the condition in <paramref name="predicate" />.-or-The source sequence is empty.</exception>
|
||||
// Token: 0x060002AD RID: 685 RVA: 0x0000E294 File Offset: 0x0000C494
|
||||
public static TSource First<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.First(predicate, Enumerable.Fallback.Throw);
|
||||
}
|
||||
|
||||
/// <summary>Returns the first element of a sequence, or a default value if the sequence contains no elements.</summary>
|
||||
/// <returns>default(<paramref name="TSource" />) if <paramref name="source" /> is empty; otherwise, the first element in <paramref name="source" />.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the first element of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002AE RID: 686 RVA: 0x0000E2A8 File Offset: 0x0000C4A8
|
||||
public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
using (IEnumerator<TSource> enumerator = source.GetEnumerator())
|
||||
{
|
||||
if (enumerator.MoveNext())
|
||||
{
|
||||
return enumerator.Current;
|
||||
}
|
||||
}
|
||||
return default(TSource);
|
||||
}
|
||||
|
||||
/// <summary>Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.</summary>
|
||||
/// <returns>default(<paramref name="TSource" />) if <paramref name="source" /> is empty or if no element passes the test specified by <paramref name="predicate" />; otherwise, the first element in <paramref name="source" /> that passes the test specified by <paramref name="predicate" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x060002AF RID: 687 RVA: 0x0000E318 File Offset: 0x0000C518
|
||||
public static TSource FirstOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.First(predicate, Enumerable.Fallback.Default);
|
||||
}
|
||||
|
||||
// Token: 0x060002B0 RID: 688 RVA: 0x0000E32C File Offset: 0x0000C52C
|
||||
private static List<T> ContainsGroup<K, T>(Dictionary<K, List<T>> items, K key, IEqualityComparer<K> comparer)
|
||||
{
|
||||
IEqualityComparer<K> equalityComparer = comparer ?? EqualityComparer<K>.Default;
|
||||
foreach (KeyValuePair<K, List<T>> keyValuePair in items)
|
||||
{
|
||||
if (equalityComparer.Equals(keyValuePair.Key, key))
|
||||
{
|
||||
return keyValuePair.Value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>Groups the elements of a sequence according to a specified key selector function.</summary>
|
||||
/// <returns>An IEnumerable<IGrouping<TKey, TSource>> in C# or IEnumerable(Of IGrouping(Of TKey, TSource)) in Visual Basic where each <see cref="T:System.Linq.IGrouping`2" /> object contains a sequence of objects and a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x060002B1 RID: 689 RVA: 0x0000E3B8 File Offset: 0x0000C5B8
|
||||
public static IEnumerable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
||||
{
|
||||
return source.GroupBy(keySelector, null);
|
||||
}
|
||||
|
||||
/// <summary>Groups the elements of a sequence according to a specified key selector function and compares the keys by using a specified comparer.</summary>
|
||||
/// <returns>An IEnumerable<IGrouping<TKey, TSource>> in C# or IEnumerable(Of IGrouping(Of TKey, TSource)) in Visual Basic where each <see cref="T:System.Linq.IGrouping`2" /> object contains a collection of objects and a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x060002B2 RID: 690 RVA: 0x0000E3C4 File Offset: 0x0000C5C4
|
||||
public static IEnumerable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return source.CreateGroupByIterator(keySelector, comparer);
|
||||
}
|
||||
|
||||
// Token: 0x060002B3 RID: 691 RVA: 0x0000E3D8 File Offset: 0x0000C5D8
|
||||
private static IEnumerable<IGrouping<TKey, TSource>> CreateGroupByIterator<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
Dictionary<TKey, List<TSource>> groups = new Dictionary<TKey, List<TSource>>();
|
||||
List<TSource> nullList = new List<TSource>();
|
||||
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<TSource> group = Enumerable.ContainsGroup<TKey, TSource>(groups, key, comparer);
|
||||
if (group == null)
|
||||
{
|
||||
group = new List<TSource>();
|
||||
groups.Add(key, group);
|
||||
counter++;
|
||||
}
|
||||
group.Add(element);
|
||||
}
|
||||
}
|
||||
counter = 0;
|
||||
foreach (KeyValuePair<TKey, List<TSource>> group2 in groups)
|
||||
{
|
||||
if (counter == nullCounter)
|
||||
{
|
||||
yield return new Grouping<TKey, TSource>(default(TKey), nullList);
|
||||
counter++;
|
||||
}
|
||||
yield return new Grouping<TKey, TSource>(group2.Key, group2.Value);
|
||||
counter++;
|
||||
}
|
||||
if (counter == nullCounter)
|
||||
{
|
||||
yield return new Grouping<TKey, TSource>(default(TKey), nullList);
|
||||
counter++;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>An IEnumerable<IGrouping<TKey, TElement>> in C# or IEnumerable(Of IGrouping(Of TKey, TElement)) in Visual Basic where each <see cref="T:System.Linq.IGrouping`2" /> object contains a collection of objects of type <paramref name="TElement" /> and a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <param name="elementSelector">A function to map each source element to an element in the <see cref="T:System.Linq.IGrouping`2" />.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the elements in the <see cref="T:System.Linq.IGrouping`2" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> is null.</exception>
|
||||
// Token: 0x060002B4 RID: 692 RVA: 0x0000E420 File Offset: 0x0000C620
|
||||
public static IEnumerable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
|
||||
{
|
||||
return source.GroupBy(keySelector, elementSelector, null);
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>An IEnumerable<IGrouping<TKey, TElement>> in C# or IEnumerable(Of IGrouping(Of TKey, TElement)) in Visual Basic where each <see cref="T:System.Linq.IGrouping`2" /> object contains a collection of objects of type <paramref name="TElement" /> and a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <param name="elementSelector">A function to map each source element to an element in an <see cref="T:System.Linq.IGrouping`2" />.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the elements in the <see cref="T:System.Linq.IGrouping`2" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> is null.</exception>
|
||||
// Token: 0x060002B5 RID: 693 RVA: 0x0000E42C File Offset: 0x0000C62C
|
||||
public static IEnumerable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeyElementSelectors(source, keySelector, elementSelector);
|
||||
return source.CreateGroupByIterator(keySelector, elementSelector, comparer);
|
||||
}
|
||||
|
||||
// Token: 0x060002B6 RID: 694 RVA: 0x0000E440 File Offset: 0x0000C640
|
||||
private static IEnumerable<IGrouping<TKey, TElement>> CreateGroupByIterator<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
Dictionary<TKey, List<TElement>> groups = new Dictionary<TKey, List<TElement>>();
|
||||
List<TElement> nullList = new List<TElement>();
|
||||
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<TElement> group = Enumerable.ContainsGroup<TKey, TElement>(groups, key, comparer);
|
||||
if (group == null)
|
||||
{
|
||||
group = new List<TElement>();
|
||||
groups.Add(key, group);
|
||||
counter++;
|
||||
}
|
||||
group.Add(element);
|
||||
}
|
||||
}
|
||||
counter = 0;
|
||||
foreach (KeyValuePair<TKey, List<TElement>> group2 in groups)
|
||||
{
|
||||
if (counter == nullCounter)
|
||||
{
|
||||
yield return new Grouping<TKey, TElement>(default(TKey), nullList);
|
||||
counter++;
|
||||
}
|
||||
yield return new Grouping<TKey, TElement>(group2.Key, group2.Value);
|
||||
counter++;
|
||||
}
|
||||
if (counter == nullCounter)
|
||||
{
|
||||
yield return new Grouping<TKey, TElement>(default(TKey), nullList);
|
||||
counter++;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>A collection of elements of type <paramref name="TResult" /> where each element represents a projection over a group and its key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <param name="elementSelector">A function to map each source element to an element in an <see cref="T:System.Linq.IGrouping`2" />.</param>
|
||||
/// <param name="resultSelector">A function to create a result value from each group.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the elements in each <see cref="T:System.Linq.IGrouping`2" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result value returned by <paramref name="resultSelector" />.</typeparam>
|
||||
// Token: 0x060002B7 RID: 695 RVA: 0x0000E494 File Offset: 0x0000C694
|
||||
public static IEnumerable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector)
|
||||
{
|
||||
return source.GroupBy(keySelector, elementSelector, resultSelector, null);
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>A collection of elements of type <paramref name="TResult" /> where each element represents a projection over a group and its key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <param name="elementSelector">A function to map each source element to an element in an <see cref="T:System.Linq.IGrouping`2" />.</param>
|
||||
/// <param name="resultSelector">A function to create a result value from each group.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys with.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the elements in each <see cref="T:System.Linq.IGrouping`2" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result value returned by <paramref name="resultSelector" />.</typeparam>
|
||||
// Token: 0x060002B8 RID: 696 RVA: 0x0000E4A0 File Offset: 0x0000C6A0
|
||||
public static IEnumerable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
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<TResult> CreateGroupByIterator<TSource, TKey, TElement, TResult>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
IEnumerable<IGrouping<TKey, TElement>> groups = source.GroupBy(keySelector, elementSelector, comparer);
|
||||
foreach (IGrouping<TKey, TElement> group in groups)
|
||||
{
|
||||
yield return resultSelector(group.Key, group);
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key.</summary>
|
||||
/// <returns>A collection of elements of type <paramref name="TResult" /> where each element represents a projection over a group and its key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <param name="resultSelector">A function to create a result value from each group.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result value returned by <paramref name="resultSelector" />.</typeparam>
|
||||
// Token: 0x060002BA RID: 698 RVA: 0x0000E51C File Offset: 0x0000C71C
|
||||
public static IEnumerable<TResult> GroupBy<TSource, TKey, TResult>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector)
|
||||
{
|
||||
return source.GroupBy(keySelector, resultSelector, null);
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>A collection of elements of type <paramref name="TResult" /> where each element represents a projection over a group and its key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <param name="resultSelector">A function to create a result value from each group.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys with.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result value returned by <paramref name="resultSelector" />.</typeparam>
|
||||
// Token: 0x060002BB RID: 699 RVA: 0x0000E528 File Offset: 0x0000C728
|
||||
public static IEnumerable<TResult> GroupBy<TSource, TKey, TResult>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeyResultSelectors(source, keySelector, resultSelector);
|
||||
return source.CreateGroupByIterator(keySelector, resultSelector, comparer);
|
||||
}
|
||||
|
||||
// Token: 0x060002BC RID: 700 RVA: 0x0000E53C File Offset: 0x0000C73C
|
||||
private static IEnumerable<TResult> CreateGroupByIterator<TSource, TKey, TResult>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
IEnumerable<IGrouping<TKey, TSource>> groups = source.GroupBy(keySelector, comparer);
|
||||
foreach (IGrouping<TKey, TSource> group in groups)
|
||||
{
|
||||
yield return resultSelector(group.Key, group);
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains elements of type <paramref name="TResult" /> that are obtained by performing a grouped join on two sequences.</returns>
|
||||
/// <param name="outer">The first sequence to join.</param>
|
||||
/// <param name="inner">The sequence to join to the first sequence.</param>
|
||||
/// <param name="outerKeySelector">A function to extract the join key from each element of the first sequence.</param>
|
||||
/// <param name="innerKeySelector">A function to extract the join key from each element of the second sequence.</param>
|
||||
/// <param name="resultSelector">A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.</param>
|
||||
/// <typeparam name="TOuter">The type of the elements of the first sequence.</typeparam>
|
||||
/// <typeparam name="TInner">The type of the elements of the second sequence.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the keys returned by the key selector functions.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result elements.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="outer" /> or <paramref name="inner" /> or <paramref name="outerKeySelector" /> or <paramref name="innerKeySelector" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x060002BD RID: 701 RVA: 0x0000E590 File Offset: 0x0000C790
|
||||
public static IEnumerable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector)
|
||||
{
|
||||
return outer.GroupJoin(inner, outerKeySelector, innerKeySelector, resultSelector, null);
|
||||
}
|
||||
|
||||
/// <summary>Correlates the elements of two sequences based on key equality and groups the results. A specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> is used to compare keys.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains elements of type <paramref name="TResult" /> that are obtained by performing a grouped join on two sequences.</returns>
|
||||
/// <param name="outer">The first sequence to join.</param>
|
||||
/// <param name="inner">The sequence to join to the first sequence.</param>
|
||||
/// <param name="outerKeySelector">A function to extract the join key from each element of the first sequence.</param>
|
||||
/// <param name="innerKeySelector">A function to extract the join key from each element of the second sequence.</param>
|
||||
/// <param name="resultSelector">A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to hash and compare keys.</param>
|
||||
/// <typeparam name="TOuter">The type of the elements of the first sequence.</typeparam>
|
||||
/// <typeparam name="TInner">The type of the elements of the second sequence.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the keys returned by the key selector functions.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result elements.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="outer" /> or <paramref name="inner" /> or <paramref name="outerKeySelector" /> or <paramref name="innerKeySelector" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x060002BE RID: 702 RVA: 0x0000E5A0 File Offset: 0x0000C7A0
|
||||
public static IEnumerable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
Check.JoinSelectors(outer, inner, outerKeySelector, innerKeySelector, resultSelector);
|
||||
if (comparer == null)
|
||||
{
|
||||
comparer = EqualityComparer<TKey>.Default;
|
||||
}
|
||||
return outer.CreateGroupJoinIterator(inner, outerKeySelector, innerKeySelector, resultSelector, comparer);
|
||||
}
|
||||
|
||||
// Token: 0x060002BF RID: 703 RVA: 0x0000E5D4 File Offset: 0x0000C7D4
|
||||
private static IEnumerable<TResult> CreateGroupJoinIterator<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
ILookup<TKey, TInner> 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<TInner>());
|
||||
}
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Produces the set intersection of two sequences by using the default equality comparer to compare values.</summary>
|
||||
/// <returns>A sequence that contains the elements that form the set intersection of two sequences.</returns>
|
||||
/// <param name="first">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements that also appear in <paramref name="second" /> will be returned.</param>
|
||||
/// <param name="second">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements that also appear in the first sequence will be returned.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
|
||||
// Token: 0x060002C0 RID: 704 RVA: 0x0000E648 File Offset: 0x0000C848
|
||||
public static IEnumerable<TSource> Intersect<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second)
|
||||
{
|
||||
return first.Intersect(second, null);
|
||||
}
|
||||
|
||||
/// <summary>Produces the set intersection of two sequences by using the specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</summary>
|
||||
/// <returns>A sequence that contains the elements that form the set intersection of two sequences.</returns>
|
||||
/// <param name="first">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements that also appear in <paramref name="second" /> will be returned.</param>
|
||||
/// <param name="second">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements that also appear in the first sequence will be returned.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
|
||||
// Token: 0x060002C1 RID: 705 RVA: 0x0000E654 File Offset: 0x0000C854
|
||||
public static IEnumerable<TSource> Intersect<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
Check.FirstAndSecond(first, second);
|
||||
if (comparer == null)
|
||||
{
|
||||
comparer = EqualityComparer<TSource>.Default;
|
||||
}
|
||||
return Enumerable.CreateIntersectIterator<TSource>(first, second, comparer);
|
||||
}
|
||||
|
||||
// Token: 0x060002C2 RID: 706 RVA: 0x0000E674 File Offset: 0x0000C874
|
||||
private static IEnumerable<TSource> CreateIntersectIterator<TSource>(IEnumerable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
HashSet<TSource> items = new HashSet<TSource>(second, comparer);
|
||||
foreach (TSource element in first)
|
||||
{
|
||||
if (items.Remove(element))
|
||||
{
|
||||
yield return element;
|
||||
}
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Correlates the elements of two sequences based on matching keys. A specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> is used to compare keys.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that has elements of type <paramref name="TResult" /> that are obtained by performing an inner join on two sequences.</returns>
|
||||
/// <param name="outer">The first sequence to join.</param>
|
||||
/// <param name="inner">The sequence to join to the first sequence.</param>
|
||||
/// <param name="outerKeySelector">A function to extract the join key from each element of the first sequence.</param>
|
||||
/// <param name="innerKeySelector">A function to extract the join key from each element of the second sequence.</param>
|
||||
/// <param name="resultSelector">A function to create a result element from two matching elements.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to hash and compare keys.</param>
|
||||
/// <typeparam name="TOuter">The type of the elements of the first sequence.</typeparam>
|
||||
/// <typeparam name="TInner">The type of the elements of the second sequence.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the keys returned by the key selector functions.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result elements.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="outer" /> or <paramref name="inner" /> or <paramref name="outerKeySelector" /> or <paramref name="innerKeySelector" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x060002C3 RID: 707 RVA: 0x0000E6BC File Offset: 0x0000C8BC
|
||||
public static IEnumerable<TResult> Join<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
Check.JoinSelectors(outer, inner, outerKeySelector, innerKeySelector, resultSelector);
|
||||
if (comparer == null)
|
||||
{
|
||||
comparer = EqualityComparer<TKey>.Default;
|
||||
}
|
||||
return outer.CreateJoinIterator(inner, outerKeySelector, innerKeySelector, resultSelector, comparer);
|
||||
}
|
||||
|
||||
// Token: 0x060002C4 RID: 708 RVA: 0x0000E6F0 File Offset: 0x0000C8F0
|
||||
private static IEnumerable<TResult> CreateJoinIterator<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
ILookup<TKey, TInner> 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;
|
||||
}
|
||||
|
||||
/// <summary>Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that has elements of type <paramref name="TResult" /> that are obtained by performing an inner join on two sequences.</returns>
|
||||
/// <param name="outer">The first sequence to join.</param>
|
||||
/// <param name="inner">The sequence to join to the first sequence.</param>
|
||||
/// <param name="outerKeySelector">A function to extract the join key from each element of the first sequence.</param>
|
||||
/// <param name="innerKeySelector">A function to extract the join key from each element of the second sequence.</param>
|
||||
/// <param name="resultSelector">A function to create a result element from two matching elements.</param>
|
||||
/// <typeparam name="TOuter">The type of the elements of the first sequence.</typeparam>
|
||||
/// <typeparam name="TInner">The type of the elements of the second sequence.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the keys returned by the key selector functions.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result elements.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="outer" /> or <paramref name="inner" /> or <paramref name="outerKeySelector" /> or <paramref name="innerKeySelector" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x060002C5 RID: 709 RVA: 0x0000E764 File Offset: 0x0000C964
|
||||
public static IEnumerable<TResult> Join<TOuter, TInner, TKey, TResult>(this IEnumerable<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector)
|
||||
{
|
||||
return outer.Join(inner, outerKeySelector, innerKeySelector, resultSelector, null);
|
||||
}
|
||||
|
||||
// Token: 0x060002C6 RID: 710 RVA: 0x0000E774 File Offset: 0x0000C974
|
||||
private static TSource Last<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> 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;
|
||||
}
|
||||
|
||||
/// <summary>Returns the last element of a sequence.</summary>
|
||||
/// <returns>The value at the last position in the source sequence.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the last element of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The source sequence is empty.</exception>
|
||||
// Token: 0x060002C7 RID: 711 RVA: 0x0000E804 File Offset: 0x0000CA04
|
||||
public static TSource Last<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
ICollection<TSource> collection = source as ICollection<TSource>;
|
||||
if (collection != null && collection.Count == 0)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
IList<TSource> list = source as IList<TSource>;
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>Returns the last element of a sequence that satisfies a specified condition.</summary>
|
||||
/// <returns>The last element in the sequence that passes the test in the specified predicate function.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">No element satisfies the condition in <paramref name="predicate" />.-or-The source sequence is empty.</exception>
|
||||
// Token: 0x060002C8 RID: 712 RVA: 0x0000E8C0 File Offset: 0x0000CAC0
|
||||
public static TSource Last<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Last(predicate, Enumerable.Fallback.Throw);
|
||||
}
|
||||
|
||||
/// <summary>Returns the last element of a sequence, or a default value if the sequence contains no elements.</summary>
|
||||
/// <returns>default(<paramref name="TSource" />) if the source sequence is empty; otherwise, the last element in the <see cref="T:System.Collections.Generic.IEnumerable`1" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the last element of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002C9 RID: 713 RVA: 0x0000E8D4 File Offset: 0x0000CAD4
|
||||
public static TSource LastOrDefault<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
IList<TSource> list = source as IList<TSource>;
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>Returns the last element of a sequence that satisfies a condition or a default value if no such element is found.</summary>
|
||||
/// <returns>default(<paramref name="TSource" />) 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.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return an element from.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x060002CA RID: 714 RVA: 0x0000E988 File Offset: 0x0000CB88
|
||||
public static TSource LastOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Last(predicate, Enumerable.Fallback.Default);
|
||||
}
|
||||
|
||||
/// <summary>Returns an <see cref="T:System.Int64" /> that represents the total number of elements in a sequence.</summary>
|
||||
/// <returns>The number of elements in the source sequence.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements to be counted.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The number of elements exceeds <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x060002CB RID: 715 RVA: 0x0000E99C File Offset: 0x0000CB9C
|
||||
public static long LongCount<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
long num = 0L;
|
||||
using (IEnumerator<TSource> enumerator = source.GetEnumerator())
|
||||
{
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
num += 1L;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Returns an <see cref="T:System.Int64" /> that represents how many elements in a sequence satisfy a condition.</summary>
|
||||
/// <returns>A number that represents how many elements in the sequence satisfy the condition in the predicate function.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements to be counted.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The number of matching elements exceeds <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x060002CC RID: 716 RVA: 0x0000EA00 File Offset: 0x0000CC00
|
||||
public static long LongCount<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
long num = 0L;
|
||||
foreach (TSource tsource in source)
|
||||
{
|
||||
if (selector(tsource))
|
||||
{
|
||||
num += 1L;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Returns the maximum value in a sequence of <see cref="T:System.Int32" /> values.</summary>
|
||||
/// <returns>The maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Int32" /> values to determine the maximum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002CD RID: 717 RVA: 0x0000EA74 File Offset: 0x0000CC74
|
||||
public static int Max(this IEnumerable<int> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.Iterate<int, int>(source, int.MinValue, (int a, int b) => Math.Max(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the maximum value in a sequence of <see cref="T:System.Int64" /> values.</summary>
|
||||
/// <returns>The maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Int64" /> values to determine the maximum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002CE RID: 718 RVA: 0x0000EAB0 File Offset: 0x0000CCB0
|
||||
public static long Max(this IEnumerable<long> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.Iterate<long, long>(source, long.MinValue, (long a, long b) => Math.Max(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the maximum value in a sequence of <see cref="T:System.Double" /> values.</summary>
|
||||
/// <returns>The maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Double" /> values to determine the maximum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002CF RID: 719 RVA: 0x0000EAF0 File Offset: 0x0000CCF0
|
||||
public static double Max(this IEnumerable<double> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.Iterate<double, double>(source, double.MinValue, (double a, double b) => Math.Max(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the maximum value in a sequence of <see cref="T:System.Single" /> values.</summary>
|
||||
/// <returns>The maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Single" /> values to determine the maximum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002D0 RID: 720 RVA: 0x0000EB30 File Offset: 0x0000CD30
|
||||
public static float Max(this IEnumerable<float> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.Iterate<float, float>(source, float.MinValue, (float a, float b) => Math.Max(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the maximum value in a sequence of <see cref="T:System.Decimal" /> values.</summary>
|
||||
/// <returns>The maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to determine the maximum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002D1 RID: 721 RVA: 0x0000EB6C File Offset: 0x0000CD6C
|
||||
public static decimal Max(this IEnumerable<decimal> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.Iterate<decimal, decimal>(source, decimal.MinValue, (decimal a, decimal b) => Math.Max(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the maximum value in a sequence of nullable <see cref="T:System.Int32" /> values.</summary>
|
||||
/// <returns>A value of type Nullable<Int32> in C# or Nullable(Of Int32) in Visual Basic that corresponds to the maximum value in the sequence. </returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to determine the maximum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002D2 RID: 722 RVA: 0x0000EBA4 File Offset: 0x0000CDA4
|
||||
public static int? Max(this IEnumerable<int?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.IterateNullable<int>(source, (int a, int b) => Math.Max(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the maximum value in a sequence of nullable <see cref="T:System.Int64" /> values.</summary>
|
||||
/// <returns>A value of type Nullable<Int64> in C# or Nullable(Of Int64) in Visual Basic that corresponds to the maximum value in the sequence. </returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to determine the maximum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002D3 RID: 723 RVA: 0x0000EBD0 File Offset: 0x0000CDD0
|
||||
public static long? Max(this IEnumerable<long?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.IterateNullable<long>(source, (long a, long b) => Math.Max(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the maximum value in a sequence of nullable <see cref="T:System.Double" /> values.</summary>
|
||||
/// <returns>A value of type Nullable<Double> in C# or Nullable(Of Double) in Visual Basic that corresponds to the maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to determine the maximum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002D4 RID: 724 RVA: 0x0000EBFC File Offset: 0x0000CDFC
|
||||
public static double? Max(this IEnumerable<double?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.IterateNullable<double>(source, (double a, double b) => Math.Max(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the maximum value in a sequence of nullable <see cref="T:System.Single" /> values.</summary>
|
||||
/// <returns>A value of type Nullable<Single> in C# or Nullable(Of Single) in Visual Basic that corresponds to the maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to determine the maximum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002D5 RID: 725 RVA: 0x0000EC28 File Offset: 0x0000CE28
|
||||
public static float? Max(this IEnumerable<float?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.IterateNullable<float>(source, (float a, float b) => Math.Max(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the maximum value in a sequence of nullable <see cref="T:System.Decimal" /> values.</summary>
|
||||
/// <returns>A value of type Nullable<Decimal> in C# or Nullable(Of Decimal) in Visual Basic that corresponds to the maximum value in the sequence. </returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to determine the maximum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002D6 RID: 726 RVA: 0x0000EC54 File Offset: 0x0000CE54
|
||||
public static decimal? Max(this IEnumerable<decimal?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.IterateNullable<decimal>(source, (decimal a, decimal b) => Math.Max(a, b));
|
||||
}
|
||||
|
||||
// Token: 0x060002D7 RID: 727 RVA: 0x0000EC80 File Offset: 0x0000CE80
|
||||
private static T? IterateNullable<T>(IEnumerable<T?> source, Func<T, T, T> 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<TSource, TRet>(IEnumerable<TSource> source, Func<TSource, TRet?> source_selector, Func<TRet?, TRet?, bool> 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<TSource>(IEnumerable<TSource> source, Func<TSource, TSource, bool> 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<TSource>(IEnumerable<TSource> source, Func<TSource, TSource, bool> 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;
|
||||
}
|
||||
|
||||
/// <summary>Returns the maximum value in a generic sequence.</summary>
|
||||
/// <returns>The maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the maximum value of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002DB RID: 731 RVA: 0x0000EF08 File Offset: 0x0000D108
|
||||
public static TSource Max<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
Comparer<TSource> comparer = Comparer<TSource>.Default;
|
||||
Func<TSource, TSource, bool> func = (TSource a, TSource b) => comparer.Compare(a, b) > 0;
|
||||
if (default(TSource) == null)
|
||||
{
|
||||
return Enumerable.IterateNullable<TSource>(source, func);
|
||||
}
|
||||
return Enumerable.IterateNonNullable<TSource>(source, func);
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Int32" /> value.</summary>
|
||||
/// <returns>The maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the maximum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002DC RID: 732 RVA: 0x0000EF5C File Offset: 0x0000D15C
|
||||
public static int Max<TSource>(this IEnumerable<TSource> source, Func<TSource, int> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.Iterate<TSource, int>(source, int.MinValue, (TSource a, int b) => Math.Max(selector(a), b));
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Int64" /> value.</summary>
|
||||
/// <returns>The maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the maximum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002DD RID: 733 RVA: 0x0000EF9C File Offset: 0x0000D19C
|
||||
public static long Max<TSource>(this IEnumerable<TSource> source, Func<TSource, long> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.Iterate<TSource, long>(source, long.MinValue, (TSource a, long b) => Math.Max(selector(a), b));
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Double" /> value.</summary>
|
||||
/// <returns>The maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the maximum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002DE RID: 734 RVA: 0x0000EFE0 File Offset: 0x0000D1E0
|
||||
public static double Max<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.Iterate<TSource, double>(source, double.MinValue, (TSource a, double b) => Math.Max(selector(a), b));
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Single" /> value.</summary>
|
||||
/// <returns>The maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the maximum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002DF RID: 735 RVA: 0x0000F024 File Offset: 0x0000D224
|
||||
public static float Max<TSource>(this IEnumerable<TSource> source, Func<TSource, float> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.Iterate<TSource, float>(source, float.MinValue, (TSource a, float b) => Math.Max(selector(a), b));
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the maximum <see cref="T:System.Decimal" /> value.</summary>
|
||||
/// <returns>The maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the maximum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002E0 RID: 736 RVA: 0x0000F064 File Offset: 0x0000D264
|
||||
public static decimal Max<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.Iterate<TSource, decimal>(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<T, U>(IEnumerable<T> source, U initValue, Func<T, U, U> selector)
|
||||
{
|
||||
bool flag = true;
|
||||
foreach (T t in source)
|
||||
{
|
||||
initValue = selector(t, initValue);
|
||||
flag = false;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
return initValue;
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Int32" /> value.</summary>
|
||||
/// <returns>The value of type Nullable<Int32> in C# or Nullable(Of Int32) in Visual Basic that corresponds to the maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the maximum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060002E2 RID: 738 RVA: 0x0000F11C File Offset: 0x0000D31C
|
||||
public static int? Max<TSource>(this IEnumerable<TSource> source, Func<TSource, int?> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.IterateNullable<TSource, int>(source, selector, (int? a, int? b) => a != null && b != null && a.Value > b.Value);
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Int64" /> value.</summary>
|
||||
/// <returns>The value of type Nullable<Int64> in C# or Nullable(Of Int64) in Visual Basic that corresponds to the maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the maximum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060002E3 RID: 739 RVA: 0x0000F138 File Offset: 0x0000D338
|
||||
public static long? Max<TSource>(this IEnumerable<TSource> source, Func<TSource, long?> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.IterateNullable<TSource, long>(source, selector, (long? a, long? b) => a != null && b != null && a.Value > b.Value);
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Double" /> value.</summary>
|
||||
/// <returns>The value of type Nullable<Double> in C# or Nullable(Of Double) in Visual Basic that corresponds to the maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the maximum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060002E4 RID: 740 RVA: 0x0000F154 File Offset: 0x0000D354
|
||||
public static double? Max<TSource>(this IEnumerable<TSource> source, Func<TSource, double?> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.IterateNullable<TSource, double>(source, selector, (double? a, double? b) => a != null && b != null && a.Value > b.Value);
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Single" /> value.</summary>
|
||||
/// <returns>The value of type Nullable<Single> in C# or Nullable(Of Single) in Visual Basic that corresponds to the maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the maximum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060002E5 RID: 741 RVA: 0x0000F170 File Offset: 0x0000D370
|
||||
public static float? Max<TSource>(this IEnumerable<TSource> source, Func<TSource, float?> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.IterateNullable<TSource, float>(source, selector, (float? a, float? b) => a != null && b != null && a.Value > b.Value);
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the maximum nullable <see cref="T:System.Decimal" /> value.</summary>
|
||||
/// <returns>The value of type Nullable<Decimal> in C# or Nullable(Of Decimal) in Visual Basic that corresponds to the maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the maximum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060002E6 RID: 742 RVA: 0x0000F18C File Offset: 0x0000D38C
|
||||
public static decimal? Max<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal?> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.IterateNullable<TSource, decimal>(source, selector, (decimal? a, decimal? b) => a != null && b != null && a.Value > b.Value);
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a generic sequence and returns the maximum resulting value.</summary>
|
||||
/// <returns>The maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the maximum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the value returned by <paramref name="selector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060002E7 RID: 743 RVA: 0x0000F1A8 File Offset: 0x0000D3A8
|
||||
public static TResult Max<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Select(selector).Max<TResult>();
|
||||
}
|
||||
|
||||
/// <summary>Returns the minimum value in a sequence of <see cref="T:System.Int32" /> values.</summary>
|
||||
/// <returns>The minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Int32" /> values to determine the minimum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002E8 RID: 744 RVA: 0x0000F1C0 File Offset: 0x0000D3C0
|
||||
public static int Min(this IEnumerable<int> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.Iterate<int, int>(source, int.MaxValue, (int a, int b) => Math.Min(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the minimum value in a sequence of <see cref="T:System.Int64" /> values.</summary>
|
||||
/// <returns>The minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Int64" /> values to determine the minimum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002E9 RID: 745 RVA: 0x0000F1FC File Offset: 0x0000D3FC
|
||||
public static long Min(this IEnumerable<long> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.Iterate<long, long>(source, long.MaxValue, (long a, long b) => Math.Min(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the minimum value in a sequence of <see cref="T:System.Double" /> values.</summary>
|
||||
/// <returns>The minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Double" /> values to determine the minimum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002EA RID: 746 RVA: 0x0000F23C File Offset: 0x0000D43C
|
||||
public static double Min(this IEnumerable<double> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.Iterate<double, double>(source, double.MaxValue, (double a, double b) => Math.Min(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the minimum value in a sequence of <see cref="T:System.Single" /> values.</summary>
|
||||
/// <returns>The minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Single" /> values to determine the minimum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002EB RID: 747 RVA: 0x0000F27C File Offset: 0x0000D47C
|
||||
public static float Min(this IEnumerable<float> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.Iterate<float, float>(source, float.MaxValue, (float a, float b) => Math.Min(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the minimum value in a sequence of <see cref="T:System.Decimal" /> values.</summary>
|
||||
/// <returns>The minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to determine the minimum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002EC RID: 748 RVA: 0x0000F2B8 File Offset: 0x0000D4B8
|
||||
public static decimal Min(this IEnumerable<decimal> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.Iterate<decimal, decimal>(source, decimal.MaxValue, (decimal a, decimal b) => Math.Min(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the minimum value in a sequence of nullable <see cref="T:System.Int32" /> values.</summary>
|
||||
/// <returns>A value of type Nullable<Int32> in C# or Nullable(Of Int32) in Visual Basic that corresponds to the minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to determine the minimum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002ED RID: 749 RVA: 0x0000F2F0 File Offset: 0x0000D4F0
|
||||
public static int? Min(this IEnumerable<int?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.IterateNullable<int>(source, (int a, int b) => Math.Min(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the minimum value in a sequence of nullable <see cref="T:System.Int64" /> values.</summary>
|
||||
/// <returns>A value of type Nullable<Int64> in C# or Nullable(Of Int64) in Visual Basic that corresponds to the minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to determine the minimum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002EE RID: 750 RVA: 0x0000F31C File Offset: 0x0000D51C
|
||||
public static long? Min(this IEnumerable<long?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.IterateNullable<long>(source, (long a, long b) => Math.Min(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the minimum value in a sequence of nullable <see cref="T:System.Double" /> values.</summary>
|
||||
/// <returns>A value of type Nullable<Double> in C# or Nullable(Of Double) in Visual Basic that corresponds to the minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to determine the minimum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002EF RID: 751 RVA: 0x0000F348 File Offset: 0x0000D548
|
||||
public static double? Min(this IEnumerable<double?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.IterateNullable<double>(source, (double a, double b) => Math.Min(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the minimum value in a sequence of nullable <see cref="T:System.Single" /> values.</summary>
|
||||
/// <returns>A value of type Nullable<Single> in C# or Nullable(Of Single) in Visual Basic that corresponds to the minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to determine the minimum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002F0 RID: 752 RVA: 0x0000F374 File Offset: 0x0000D574
|
||||
public static float? Min(this IEnumerable<float?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.IterateNullable<float>(source, (float a, float b) => Math.Min(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the minimum value in a sequence of nullable <see cref="T:System.Decimal" /> values.</summary>
|
||||
/// <returns>A value of type Nullable<Decimal> in C# or Nullable(Of Decimal) in Visual Basic that corresponds to the minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to determine the minimum value of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002F1 RID: 753 RVA: 0x0000F3A0 File Offset: 0x0000D5A0
|
||||
public static decimal? Min(this IEnumerable<decimal?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.IterateNullable<decimal>(source, (decimal a, decimal b) => Math.Min(a, b));
|
||||
}
|
||||
|
||||
/// <summary>Returns the minimum value in a generic sequence.</summary>
|
||||
/// <returns>The minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the minimum value of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002F2 RID: 754 RVA: 0x0000F3CC File Offset: 0x0000D5CC
|
||||
public static TSource Min<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
Comparer<TSource> comparer = Comparer<TSource>.Default;
|
||||
Func<TSource, TSource, bool> func = (TSource a, TSource b) => comparer.Compare(a, b) < 0;
|
||||
if (default(TSource) == null)
|
||||
{
|
||||
return Enumerable.IterateNullable<TSource>(source, func);
|
||||
}
|
||||
return Enumerable.IterateNonNullable<TSource>(source, func);
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Int32" /> value.</summary>
|
||||
/// <returns>The minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the minimum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002F3 RID: 755 RVA: 0x0000F420 File Offset: 0x0000D620
|
||||
public static int Min<TSource>(this IEnumerable<TSource> source, Func<TSource, int> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.Iterate<TSource, int>(source, int.MaxValue, (TSource a, int b) => Math.Min(selector(a), b));
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Int64" /> value.</summary>
|
||||
/// <returns>The minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the minimum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002F4 RID: 756 RVA: 0x0000F460 File Offset: 0x0000D660
|
||||
public static long Min<TSource>(this IEnumerable<TSource> source, Func<TSource, long> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.Iterate<TSource, long>(source, long.MaxValue, (TSource a, long b) => Math.Min(selector(a), b));
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Double" /> value.</summary>
|
||||
/// <returns>The minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the minimum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002F5 RID: 757 RVA: 0x0000F4A4 File Offset: 0x0000D6A4
|
||||
public static double Min<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.Iterate<TSource, double>(source, double.MaxValue, (TSource a, double b) => Math.Min(selector(a), b));
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Single" /> value.</summary>
|
||||
/// <returns>The minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the minimum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002F6 RID: 758 RVA: 0x0000F4E8 File Offset: 0x0000D6E8
|
||||
public static float Min<TSource>(this IEnumerable<TSource> source, Func<TSource, float> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.Iterate<TSource, float>(source, float.MaxValue, (TSource a, float b) => Math.Min(selector(a), b));
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the minimum <see cref="T:System.Decimal" /> value.</summary>
|
||||
/// <returns>The minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the minimum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060002F7 RID: 759 RVA: 0x0000F528 File Offset: 0x0000D728
|
||||
public static decimal Min<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.Iterate<TSource, decimal>(source, decimal.MaxValue, (TSource a, decimal b) => Math.Min(selector(a), b));
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Int32" /> value.</summary>
|
||||
/// <returns>The value of type Nullable<Int32> in C# or Nullable(Of Int32) in Visual Basic that corresponds to the minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the minimum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060002F8 RID: 760 RVA: 0x0000F56C File Offset: 0x0000D76C
|
||||
public static int? Min<TSource>(this IEnumerable<TSource> source, Func<TSource, int?> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.IterateNullable<TSource, int>(source, selector, (int? a, int? b) => a != null && b != null && a.Value < b.Value);
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Int64" /> value.</summary>
|
||||
/// <returns>The value of type Nullable<Int64> in C# or Nullable(Of Int64) in Visual Basic that corresponds to the minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the minimum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060002F9 RID: 761 RVA: 0x0000F588 File Offset: 0x0000D788
|
||||
public static long? Min<TSource>(this IEnumerable<TSource> source, Func<TSource, long?> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.IterateNullable<TSource, long>(source, selector, (long? a, long? b) => a != null && b != null && a.Value < b.Value);
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Single" /> value.</summary>
|
||||
/// <returns>The value of type Nullable<Single> in C# or Nullable(Of Single) in Visual Basic that corresponds to the minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the minimum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060002FA RID: 762 RVA: 0x0000F5A4 File Offset: 0x0000D7A4
|
||||
public static float? Min<TSource>(this IEnumerable<TSource> source, Func<TSource, float?> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.IterateNullable<TSource, float>(source, selector, (float? a, float? b) => a != null && b != null && a.Value < b.Value);
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Double" /> value.</summary>
|
||||
/// <returns>The value of type Nullable<Double> in C# or Nullable(Of Double) in Visual Basic that corresponds to the minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the minimum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060002FB RID: 763 RVA: 0x0000F5C0 File Offset: 0x0000D7C0
|
||||
public static double? Min<TSource>(this IEnumerable<TSource> source, Func<TSource, double?> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.IterateNullable<TSource, double>(source, selector, (double? a, double? b) => a != null && b != null && a.Value < b.Value);
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a sequence and returns the minimum nullable <see cref="T:System.Decimal" /> value.</summary>
|
||||
/// <returns>The value of type Nullable<Decimal> in C# or Nullable(Of Decimal) in Visual Basic that corresponds to the minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the minimum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060002FC RID: 764 RVA: 0x0000F5DC File Offset: 0x0000D7DC
|
||||
public static decimal? Min<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal?> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.IterateNullable<TSource, decimal>(source, selector, (decimal? a, decimal? b) => a != null && b != null && a.Value < b.Value);
|
||||
}
|
||||
|
||||
/// <summary>Invokes a transform function on each element of a generic sequence and returns the minimum resulting value.</summary>
|
||||
/// <returns>The minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the minimum value of.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the value returned by <paramref name="selector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060002FD RID: 765 RVA: 0x0000F5F8 File Offset: 0x0000D7F8
|
||||
public static TResult Min<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Select(selector).Min<TResult>();
|
||||
}
|
||||
|
||||
/// <summary>Filters the elements of an <see cref="T:System.Collections.IEnumerable" /> based on a specified type.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains elements from the input sequence of type <paramref name="TResult" />.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Collections.IEnumerable" /> whose elements to filter.</param>
|
||||
/// <typeparam name="TResult">The type to filter the elements of the sequence on.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060002FE RID: 766 RVA: 0x0000F610 File Offset: 0x0000D810
|
||||
public static IEnumerable<TResult> OfType<TResult>(this IEnumerable source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.CreateOfTypeIterator<TResult>(source);
|
||||
}
|
||||
|
||||
// Token: 0x060002FF RID: 767 RVA: 0x0000F620 File Offset: 0x0000D820
|
||||
private static IEnumerable<TResult> CreateOfTypeIterator<TResult>(IEnumerable source)
|
||||
{
|
||||
foreach (object element in source)
|
||||
{
|
||||
if (element is TResult)
|
||||
{
|
||||
yield return (TResult)((object)element);
|
||||
}
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Sorts the elements of a sequence in ascending order according to a key.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted according to a key.</returns>
|
||||
/// <param name="source">A sequence of values to order.</param>
|
||||
/// <param name="keySelector">A function to extract a key from an element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x06000300 RID: 768 RVA: 0x0000F64C File Offset: 0x0000D84C
|
||||
public static IOrderedEnumerable<TSource> OrderBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
||||
{
|
||||
return source.OrderBy(keySelector, null);
|
||||
}
|
||||
|
||||
/// <summary>Sorts the elements of a sequence in ascending order by using a specified comparer.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted according to a key.</returns>
|
||||
/// <param name="source">A sequence of values to order.</param>
|
||||
/// <param name="keySelector">A function to extract a key from an element.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x06000301 RID: 769 RVA: 0x0000F658 File Offset: 0x0000D858
|
||||
public static IOrderedEnumerable<TSource> OrderBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return new OrderedSequence<TSource, TKey>(source, keySelector, comparer, SortDirection.Ascending);
|
||||
}
|
||||
|
||||
/// <summary>Sorts the elements of a sequence in descending order according to a key.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted in descending order according to a key.</returns>
|
||||
/// <param name="source">A sequence of values to order.</param>
|
||||
/// <param name="keySelector">A function to extract a key from an element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x06000302 RID: 770 RVA: 0x0000F66C File Offset: 0x0000D86C
|
||||
public static IOrderedEnumerable<TSource> OrderByDescending<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
||||
{
|
||||
return source.OrderByDescending(keySelector, null);
|
||||
}
|
||||
|
||||
/// <summary>Sorts the elements of a sequence in descending order by using a specified comparer.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted in descending order according to a key.</returns>
|
||||
/// <param name="source">A sequence of values to order.</param>
|
||||
/// <param name="keySelector">A function to extract a key from an element.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x06000303 RID: 771 RVA: 0x0000F678 File Offset: 0x0000D878
|
||||
public static IOrderedEnumerable<TSource> OrderByDescending<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return new OrderedSequence<TSource, TKey>(source, keySelector, comparer, SortDirection.Descending);
|
||||
}
|
||||
|
||||
/// <summary>Generates a sequence of integral numbers within a specified range.</summary>
|
||||
/// <returns>An IEnumerable<Int32> in C# or IEnumerable(Of Int32) in Visual Basic that contains a range of sequential integral numbers.</returns>
|
||||
/// <param name="start">The value of the first integer in the sequence.</param>
|
||||
/// <param name="count">The number of sequential integers to generate.</param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than 0.-or-<paramref name="start" /> + <paramref name="count" /> -1 is larger than <see cref="F:System.Int32.MaxValue" />.</exception>
|
||||
// Token: 0x06000304 RID: 772 RVA: 0x0000F68C File Offset: 0x0000D88C
|
||||
public static IEnumerable<int> 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<int> CreateRangeIterator(int start, int upto)
|
||||
{
|
||||
for (int i = start; i <= upto; i++)
|
||||
{
|
||||
yield return i;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Generates a sequence that contains one repeated value.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains a repeated value.</returns>
|
||||
/// <param name="element">The value to be repeated.</param>
|
||||
/// <param name="count">The number of times to repeat the value in the generated sequence.</param>
|
||||
/// <typeparam name="TResult">The type of the value to be repeated in the result sequence.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is less than 0.</exception>
|
||||
// Token: 0x06000306 RID: 774 RVA: 0x0000F708 File Offset: 0x0000D908
|
||||
public static IEnumerable<TResult> Repeat<TResult>(TResult element, int count)
|
||||
{
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
return Enumerable.CreateRepeatIterator<TResult>(element, count);
|
||||
}
|
||||
|
||||
// Token: 0x06000307 RID: 775 RVA: 0x0000F720 File Offset: 0x0000D920
|
||||
private static IEnumerable<TResult> CreateRepeatIterator<TResult>(TResult element, int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
yield return element;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Inverts the order of the elements in a sequence.</summary>
|
||||
/// <returns>A sequence whose elements correspond to those of the input sequence in reverse order.</returns>
|
||||
/// <param name="source">A sequence of values to reverse.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x06000308 RID: 776 RVA: 0x0000F758 File Offset: 0x0000D958
|
||||
public static IEnumerable<TSource> Reverse<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.CreateReverseIterator<TSource>(source);
|
||||
}
|
||||
|
||||
// Token: 0x06000309 RID: 777 RVA: 0x0000F768 File Offset: 0x0000D968
|
||||
private static IEnumerable<TSource> CreateReverseIterator<TSource>(IEnumerable<TSource> source)
|
||||
{
|
||||
IList<TSource> list = source as IList<TSource>;
|
||||
if (list == null)
|
||||
{
|
||||
list = new List<TSource>(source);
|
||||
}
|
||||
for (int i = list.Count - 1; i >= 0; i--)
|
||||
{
|
||||
yield return list[i];
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Projects each element of a sequence into a new form.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements are the result of invoking the transform function on each element of <paramref name="source" />.</returns>
|
||||
/// <param name="source">A sequence of values to invoke a transform function on.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the value returned by <paramref name="selector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x0600030A RID: 778 RVA: 0x0000F794 File Offset: 0x0000D994
|
||||
public static IEnumerable<TResult> Select<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.CreateSelectIterator<TSource, TResult>(source, selector);
|
||||
}
|
||||
|
||||
// Token: 0x0600030B RID: 779 RVA: 0x0000F7A4 File Offset: 0x0000D9A4
|
||||
private static IEnumerable<TResult> CreateSelectIterator<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, TResult> selector)
|
||||
{
|
||||
foreach (TSource element in source)
|
||||
{
|
||||
yield return selector(element);
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Projects each element of a sequence into a new form by incorporating the element's index.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements are the result of invoking the transform function on each element of <paramref name="source" />.</returns>
|
||||
/// <param name="source">A sequence of values to invoke a transform function on.</param>
|
||||
/// <param name="selector">A transform function to apply to each source element; the second parameter of the function represents the index of the source element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the value returned by <paramref name="selector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x0600030C RID: 780 RVA: 0x0000F7DC File Offset: 0x0000D9DC
|
||||
public static IEnumerable<TResult> Select<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, int, TResult> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.CreateSelectIterator<TSource, TResult>(source, selector);
|
||||
}
|
||||
|
||||
// Token: 0x0600030D RID: 781 RVA: 0x0000F7EC File Offset: 0x0000D9EC
|
||||
private static IEnumerable<TResult> CreateSelectIterator<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, int, TResult> selector)
|
||||
{
|
||||
int counter = 0;
|
||||
foreach (TSource element in source)
|
||||
{
|
||||
yield return selector(element, counter);
|
||||
counter++;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Projects each element of a sequence to an <see cref="T:System.Collections.Generic.IEnumerable`1" /> and flattens the resulting sequences into one sequence.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements are the result of invoking the one-to-many transform function on each element of the input sequence.</returns>
|
||||
/// <param name="source">A sequence of values to project.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the elements of the sequence returned by <paramref name="selector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x0600030E RID: 782 RVA: 0x0000F824 File Offset: 0x0000DA24
|
||||
public static IEnumerable<TResult> SelectMany<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, IEnumerable<TResult>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.CreateSelectManyIterator<TSource, TResult>(source, selector);
|
||||
}
|
||||
|
||||
// Token: 0x0600030F RID: 783 RVA: 0x0000F834 File Offset: 0x0000DA34
|
||||
private static IEnumerable<TResult> CreateSelectManyIterator<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, IEnumerable<TResult>> selector)
|
||||
{
|
||||
foreach (TSource element in source)
|
||||
{
|
||||
foreach (TResult item in selector(element))
|
||||
{
|
||||
yield return item;
|
||||
}
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Projects each element of a sequence to an <see cref="T:System.Collections.Generic.IEnumerable`1" />, and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements are the result of invoking the one-to-many transform function on each element of an input sequence.</returns>
|
||||
/// <param name="source">A sequence of values to project.</param>
|
||||
/// <param name="selector">A transform function to apply to each source element; the second parameter of the function represents the index of the source element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the elements of the sequence returned by <paramref name="selector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x06000310 RID: 784 RVA: 0x0000F86C File Offset: 0x0000DA6C
|
||||
public static IEnumerable<TResult> SelectMany<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, int, IEnumerable<TResult>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return Enumerable.CreateSelectManyIterator<TSource, TResult>(source, selector);
|
||||
}
|
||||
|
||||
// Token: 0x06000311 RID: 785 RVA: 0x0000F87C File Offset: 0x0000DA7C
|
||||
private static IEnumerable<TResult> CreateSelectManyIterator<TSource, TResult>(IEnumerable<TSource> source, Func<TSource, int, IEnumerable<TResult>> selector)
|
||||
{
|
||||
int counter = 0;
|
||||
foreach (TSource element in source)
|
||||
{
|
||||
foreach (TResult item in selector(element, counter))
|
||||
{
|
||||
yield return item;
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Projects each element of a sequence to an <see cref="T:System.Collections.Generic.IEnumerable`1" />, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements are the result of invoking the one-to-many transform function <paramref name="collectionSelector" /> on each element of <paramref name="source" /> and then mapping each of those sequence elements and their corresponding source element to a result element.</returns>
|
||||
/// <param name="source">A sequence of values to project.</param>
|
||||
/// <param name="collectionSelector">A transform function to apply to each element of the input sequence.</param>
|
||||
/// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TCollection">The type of the intermediate elements collected by <paramref name="collectionSelector" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the elements of the resulting sequence.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="collectionSelector" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x06000312 RID: 786 RVA: 0x0000F8B4 File Offset: 0x0000DAB4
|
||||
public static IEnumerable<TResult> SelectMany<TSource, TCollection, TResult>(this IEnumerable<TSource> source, Func<TSource, IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> selector)
|
||||
{
|
||||
Check.SourceAndCollectionSelectors(source, collectionSelector, selector);
|
||||
return Enumerable.CreateSelectManyIterator<TSource, TCollection, TResult>(source, collectionSelector, selector);
|
||||
}
|
||||
|
||||
// Token: 0x06000313 RID: 787 RVA: 0x0000F8C8 File Offset: 0x0000DAC8
|
||||
private static IEnumerable<TResult> CreateSelectManyIterator<TSource, TCollection, TResult>(IEnumerable<TSource> source, Func<TSource, IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> selector)
|
||||
{
|
||||
foreach (TSource element in source)
|
||||
{
|
||||
foreach (TCollection collection in collectionSelector(element))
|
||||
{
|
||||
yield return selector(element, collection);
|
||||
}
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Projects each element of a sequence to an <see cref="T:System.Collections.Generic.IEnumerable`1" />, 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.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements are the result of invoking the one-to-many transform function <paramref name="collectionSelector" /> on each element of <paramref name="source" /> and then mapping each of those sequence elements and their corresponding source element to a result element.</returns>
|
||||
/// <param name="source">A sequence of values to project.</param>
|
||||
/// <param name="collectionSelector">A transform function to apply to each source element; the second parameter of the function represents the index of the source element.</param>
|
||||
/// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TCollection">The type of the intermediate elements collected by <paramref name="collectionSelector" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the elements of the resulting sequence.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="collectionSelector" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x06000314 RID: 788 RVA: 0x0000F910 File Offset: 0x0000DB10
|
||||
public static IEnumerable<TResult> SelectMany<TSource, TCollection, TResult>(this IEnumerable<TSource> source, Func<TSource, int, IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> selector)
|
||||
{
|
||||
Check.SourceAndCollectionSelectors(source, collectionSelector, selector);
|
||||
return Enumerable.CreateSelectManyIterator<TSource, TCollection, TResult>(source, collectionSelector, selector);
|
||||
}
|
||||
|
||||
// Token: 0x06000315 RID: 789 RVA: 0x0000F924 File Offset: 0x0000DB24
|
||||
private static IEnumerable<TResult> CreateSelectManyIterator<TSource, TCollection, TResult>(IEnumerable<TSource> source, Func<TSource, int, IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> 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<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> 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;
|
||||
}
|
||||
|
||||
/// <summary>Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.</summary>
|
||||
/// <returns>The single element of the input sequence.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the single element of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The input sequence contains more than one element.-or-The input sequence is empty.</exception>
|
||||
// Token: 0x06000317 RID: 791 RVA: 0x0000FA08 File Offset: 0x0000DC08
|
||||
public static TSource Single<TSource>(this IEnumerable<TSource> 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;
|
||||
}
|
||||
|
||||
/// <summary>Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.</summary>
|
||||
/// <returns>The single element of the input sequence that satisfies a condition.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return a single element from.</param>
|
||||
/// <param name="predicate">A function to test an element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">No element satisfies the condition in <paramref name="predicate" />.-or-More than one element satisfies the condition in <paramref name="predicate" />.-or-The source sequence is empty.</exception>
|
||||
// Token: 0x06000318 RID: 792 RVA: 0x0000FA90 File Offset: 0x0000DC90
|
||||
public static TSource Single<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Single(predicate, Enumerable.Fallback.Throw);
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>The single element of the input sequence, or default(<paramref name="TSource" />) if the sequence contains no elements.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return the single element of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The input sequence contains more than one element.</exception>
|
||||
// Token: 0x06000319 RID: 793 RVA: 0x0000FAA4 File Offset: 0x0000DCA4
|
||||
public static TSource SingleOrDefault<TSource>(this IEnumerable<TSource> 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;
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>The single element of the input sequence that satisfies the condition, or default(<paramref name="TSource" />) if no such element is found.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return a single element from.</param>
|
||||
/// <param name="predicate">A function to test an element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">More than one element satisfies the condition in <paramref name="predicate" />.</exception>
|
||||
// Token: 0x0600031A RID: 794 RVA: 0x0000FB20 File Offset: 0x0000DD20
|
||||
public static TSource SingleOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Single(predicate, Enumerable.Fallback.Default);
|
||||
}
|
||||
|
||||
/// <summary>Bypasses a specified number of elements in a sequence and then returns the remaining elements.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements that occur after the specified index in the input sequence.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return elements from.</param>
|
||||
/// <param name="count">The number of elements to skip before returning the remaining elements.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x0600031B RID: 795 RVA: 0x0000FB34 File Offset: 0x0000DD34
|
||||
public static IEnumerable<TSource> Skip<TSource>(this IEnumerable<TSource> source, int count)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.CreateSkipIterator<TSource>(source, count);
|
||||
}
|
||||
|
||||
// Token: 0x0600031C RID: 796 RVA: 0x0000FB44 File Offset: 0x0000DD44
|
||||
private static IEnumerable<TSource> CreateSkipIterator<TSource>(IEnumerable<TSource> source, int count)
|
||||
{
|
||||
IEnumerator<TSource> 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;
|
||||
}
|
||||
|
||||
/// <summary>Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> 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 <paramref name="predicate" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return elements from.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x0600031D RID: 797 RVA: 0x0000FB7C File Offset: 0x0000DD7C
|
||||
public static IEnumerable<TSource> SkipWhile<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return Enumerable.CreateSkipWhileIterator<TSource>(source, predicate);
|
||||
}
|
||||
|
||||
// Token: 0x0600031E RID: 798 RVA: 0x0000FB8C File Offset: 0x0000DD8C
|
||||
private static IEnumerable<TSource> CreateSkipWhileIterator<TSource>(IEnumerable<TSource> source, Func<TSource, bool> 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;
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> 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 <paramref name="predicate" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to return elements from.</param>
|
||||
/// <param name="predicate">A function to test each source element for a condition; the second parameter of the function represents the index of the source element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x0600031F RID: 799 RVA: 0x0000FBC4 File Offset: 0x0000DDC4
|
||||
public static IEnumerable<TSource> SkipWhile<TSource>(this IEnumerable<TSource> source, Func<TSource, int, bool> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return Enumerable.CreateSkipWhileIterator<TSource>(source, predicate);
|
||||
}
|
||||
|
||||
// Token: 0x06000320 RID: 800 RVA: 0x0000FBD4 File Offset: 0x0000DDD4
|
||||
private static IEnumerable<TSource> CreateSkipWhileIterator<TSource>(IEnumerable<TSource> source, Func<TSource, int, bool> 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;
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of <see cref="T:System.Int32" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Int32" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int32.MaxValue" />.</exception>
|
||||
// Token: 0x06000321 RID: 801 RVA: 0x0000FC0C File Offset: 0x0000DE0C
|
||||
public static int Sum(this IEnumerable<int> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Sum((int a, int b) => checked(a + b));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of nullable <see cref="T:System.Int32" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int32.MaxValue" />.</exception>
|
||||
// Token: 0x06000322 RID: 802 RVA: 0x0000FC38 File Offset: 0x0000DE38
|
||||
public static int? Sum(this IEnumerable<int?> 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))));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values that are used to calculate a sum.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int32.MaxValue" />.</exception>
|
||||
// Token: 0x06000323 RID: 803 RVA: 0x0000FC6C File Offset: 0x0000DE6C
|
||||
public static int Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, int> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
int num = 0;
|
||||
checked
|
||||
{
|
||||
foreach (TSource tsource in source)
|
||||
{
|
||||
num += selector(tsource);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of nullable <see cref="T:System.Int32" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values that are used to calculate a sum.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int32.MaxValue" />.</exception>
|
||||
// Token: 0x06000324 RID: 804 RVA: 0x0000FCD8 File Offset: 0x0000DED8
|
||||
public static int? Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, int?> 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)));
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of <see cref="T:System.Int64" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Int64" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x06000325 RID: 805 RVA: 0x0000FD18 File Offset: 0x0000DF18
|
||||
public static long Sum(this IEnumerable<long> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Sum((long a, long b) => checked(a + b));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of nullable <see cref="T:System.Int64" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x06000326 RID: 806 RVA: 0x0000FD44 File Offset: 0x0000DF44
|
||||
public static long? Sum(this IEnumerable<long?> 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))));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values that are used to calculate a sum.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x06000327 RID: 807 RVA: 0x0000FD84 File Offset: 0x0000DF84
|
||||
public static long Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, long> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
long num = 0L;
|
||||
checked
|
||||
{
|
||||
foreach (TSource tsource in source)
|
||||
{
|
||||
num += selector(tsource);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of nullable <see cref="T:System.Int64" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values that are used to calculate a sum.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x06000328 RID: 808 RVA: 0x0000FDF0 File Offset: 0x0000DFF0
|
||||
public static long? Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, long?> 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)));
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of <see cref="T:System.Double" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Double" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x06000329 RID: 809 RVA: 0x0000FE30 File Offset: 0x0000E030
|
||||
public static double Sum(this IEnumerable<double> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Sum((double a, double b) => a + b);
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of nullable <see cref="T:System.Double" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x0600032A RID: 810 RVA: 0x0000FE5C File Offset: 0x0000E05C
|
||||
public static double? Sum(this IEnumerable<double?> 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)));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values that are used to calculate a sum.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x0600032B RID: 811 RVA: 0x0000FE98 File Offset: 0x0000E098
|
||||
public static double Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
double num = 0.0;
|
||||
foreach (TSource tsource in source)
|
||||
{
|
||||
num += selector(tsource);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of nullable <see cref="T:System.Double" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values that are used to calculate a sum.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x0600032C RID: 812 RVA: 0x0000FF0C File Offset: 0x0000E10C
|
||||
public static double? Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, double?> 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));
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of <see cref="T:System.Single" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Single" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x0600032D RID: 813 RVA: 0x0000FF54 File Offset: 0x0000E154
|
||||
public static float Sum(this IEnumerable<float> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Sum((float a, float b) => a + b);
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of nullable <see cref="T:System.Single" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x0600032E RID: 814 RVA: 0x0000FF80 File Offset: 0x0000E180
|
||||
public static float? Sum(this IEnumerable<float?> 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)));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values that are used to calculate a sum.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x0600032F RID: 815 RVA: 0x0000FFB8 File Offset: 0x0000E1B8
|
||||
public static float Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, float> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
float num = 0f;
|
||||
foreach (TSource tsource in source)
|
||||
{
|
||||
num += selector(tsource);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of nullable <see cref="T:System.Single" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values that are used to calculate a sum.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x06000330 RID: 816 RVA: 0x00010028 File Offset: 0x0000E228
|
||||
public static float? Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, float?> 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));
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of <see cref="T:System.Decimal" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Decimal.MaxValue" />.</exception>
|
||||
// Token: 0x06000331 RID: 817 RVA: 0x0001006C File Offset: 0x0000E26C
|
||||
public static decimal Sum(this IEnumerable<decimal> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Sum((decimal a, decimal b) => a + b);
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of nullable <see cref="T:System.Decimal" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Decimal.MaxValue" />.</exception>
|
||||
// Token: 0x06000332 RID: 818 RVA: 0x00010098 File Offset: 0x0000E298
|
||||
public static decimal? Sum(this IEnumerable<decimal?> 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)));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values that are used to calculate a sum.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Decimal.MaxValue" />.</exception>
|
||||
// Token: 0x06000333 RID: 819 RVA: 0x000100DC File Offset: 0x0000E2DC
|
||||
public static decimal Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
decimal num = 0m;
|
||||
foreach (TSource tsource in source)
|
||||
{
|
||||
num += selector(tsource);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of nullable <see cref="T:System.Decimal" /> values that are obtained by invoking a transform function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values that are used to calculate a sum.</param>
|
||||
/// <param name="selector">A transform function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Decimal.MaxValue" />.</exception>
|
||||
// Token: 0x06000334 RID: 820 RVA: 0x00010150 File Offset: 0x0000E350
|
||||
public static decimal? Sum<TSource>(this IEnumerable<TSource> source, Func<TSource, decimal?> 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<TA, TR>(this IEnumerable<TA> source, Func<TR, TA, TR> 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<TA, TR>(this IEnumerable<TA> source, TR zero, Func<TR, TA, TR> selector)
|
||||
{
|
||||
TR tr = zero;
|
||||
foreach (TA ta in source)
|
||||
{
|
||||
tr = selector(tr, ta);
|
||||
}
|
||||
return tr;
|
||||
}
|
||||
|
||||
/// <summary>Returns a specified number of contiguous elements from the start of a sequence.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the specified number of elements from the start of the input sequence.</returns>
|
||||
/// <param name="source">The sequence to return elements from.</param>
|
||||
/// <param name="count">The number of elements to return.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x06000337 RID: 823 RVA: 0x0001026C File Offset: 0x0000E46C
|
||||
public static IEnumerable<TSource> Take<TSource>(this IEnumerable<TSource> source, int count)
|
||||
{
|
||||
Check.Source(source);
|
||||
return Enumerable.CreateTakeIterator<TSource>(source, count);
|
||||
}
|
||||
|
||||
// Token: 0x06000338 RID: 824 RVA: 0x0001027C File Offset: 0x0000E47C
|
||||
private static IEnumerable<TSource> CreateTakeIterator<TSource>(IEnumerable<TSource> 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;
|
||||
}
|
||||
|
||||
/// <summary>Returns elements from a sequence as long as a specified condition is true.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements from the input sequence that occur before the element at which the test no longer passes.</returns>
|
||||
/// <param name="source">A sequence to return elements from.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x06000339 RID: 825 RVA: 0x000102B4 File Offset: 0x0000E4B4
|
||||
public static IEnumerable<TSource> TakeWhile<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return Enumerable.CreateTakeWhileIterator<TSource>(source, predicate);
|
||||
}
|
||||
|
||||
// Token: 0x0600033A RID: 826 RVA: 0x000102C4 File Offset: 0x0000E4C4
|
||||
private static IEnumerable<TSource> CreateTakeWhileIterator<TSource>(IEnumerable<TSource> source, Func<TSource, bool> predicate)
|
||||
{
|
||||
foreach (TSource element in source)
|
||||
{
|
||||
if (!predicate(element))
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
yield return element;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains elements from the input sequence that occur before the element at which the test no longer passes.</returns>
|
||||
/// <param name="source">The sequence to return elements from.</param>
|
||||
/// <param name="predicate">A function to test each source element for a condition; the second parameter of the function represents the index of the source element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x0600033B RID: 827 RVA: 0x000102FC File Offset: 0x0000E4FC
|
||||
public static IEnumerable<TSource> TakeWhile<TSource>(this IEnumerable<TSource> source, Func<TSource, int, bool> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return Enumerable.CreateTakeWhileIterator<TSource>(source, predicate);
|
||||
}
|
||||
|
||||
// Token: 0x0600033C RID: 828 RVA: 0x0001030C File Offset: 0x0000E50C
|
||||
private static IEnumerable<TSource> CreateTakeWhileIterator<TSource>(IEnumerable<TSource> source, Func<TSource, int, bool> predicate)
|
||||
{
|
||||
int counter = 0;
|
||||
foreach (TSource element in source)
|
||||
{
|
||||
if (!predicate(element, counter))
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
yield return element;
|
||||
counter++;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted according to a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IOrderedEnumerable`1" /> that contains elements to sort.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x0600033D RID: 829 RVA: 0x00010344 File Offset: 0x0000E544
|
||||
public static IOrderedEnumerable<TSource> ThenBy<TSource, TKey>(this IOrderedEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
||||
{
|
||||
return source.ThenBy(keySelector, null);
|
||||
}
|
||||
|
||||
/// <summary>Performs a subsequent ordering of the elements in a sequence in ascending order by using a specified comparer.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted according to a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IOrderedEnumerable`1" /> that contains elements to sort.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x0600033E RID: 830 RVA: 0x00010350 File Offset: 0x0000E550
|
||||
public static IOrderedEnumerable<TSource> ThenBy<TSource, TKey>(this IOrderedEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return source.CreateOrderedEnumerable<TKey>(keySelector, comparer, false);
|
||||
}
|
||||
|
||||
/// <summary>Performs a subsequent ordering of the elements in a sequence in descending order, according to a key.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted in descending order according to a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IOrderedEnumerable`1" /> that contains elements to sort.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x0600033F RID: 831 RVA: 0x00010364 File Offset: 0x0000E564
|
||||
public static IOrderedEnumerable<TSource> ThenByDescending<TSource, TKey>(this IOrderedEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
||||
{
|
||||
return source.ThenByDescending(keySelector, null);
|
||||
}
|
||||
|
||||
/// <summary>Performs a subsequent ordering of the elements in a sequence in descending order by using a specified comparer.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted in descending order according to a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IOrderedEnumerable`1" /> that contains elements to sort.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x06000340 RID: 832 RVA: 0x00010370 File Offset: 0x0000E570
|
||||
public static IOrderedEnumerable<TSource> ThenByDescending<TSource, TKey>(this IOrderedEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return source.CreateOrderedEnumerable<TKey>(keySelector, comparer, true);
|
||||
}
|
||||
|
||||
/// <summary>Creates an array from a <see cref="T:System.Collections.Generic.IEnumerable`1" />.</summary>
|
||||
/// <returns>An array that contains the elements from the input sequence.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create an array from.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x06000341 RID: 833 RVA: 0x00010384 File Offset: 0x0000E584
|
||||
public static TSource[] ToArray<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
ICollection<TSource> collection = source as ICollection<TSource>;
|
||||
if (collection != null)
|
||||
{
|
||||
TSource[] array = new TSource[collection.Count];
|
||||
collection.CopyTo(array, 0);
|
||||
return array;
|
||||
}
|
||||
return new List<TSource>(source).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Collections.Generic.Dictionary`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to specified key selector and element selector functions.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.Generic.Dictionary`2" /> that contains values of type <paramref name="TElement" /> selected from the input sequence.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Collections.Generic.Dictionary`2" /> from.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the value returned by <paramref name="elementSelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> is null.-or-<paramref name="keySelector" /> produces a key that is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="keySelector" /> produces duplicate keys for two elements.</exception>
|
||||
// Token: 0x06000342 RID: 834 RVA: 0x000103C8 File Offset: 0x0000E5C8
|
||||
public static Dictionary<TKey, TElement> ToDictionary<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
|
||||
{
|
||||
return source.ToDictionary(keySelector, elementSelector, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Collections.Generic.Dictionary`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to a specified key selector function, a comparer, and an element selector function.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.Generic.Dictionary`2" /> that contains values of type <paramref name="TElement" /> selected from the input sequence.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Collections.Generic.Dictionary`2" /> from.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the value returned by <paramref name="elementSelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> is null.-or-<paramref name="keySelector" /> produces a key that is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="keySelector" /> produces duplicate keys for two elements.</exception>
|
||||
// Token: 0x06000343 RID: 835 RVA: 0x000103D4 File Offset: 0x0000E5D4
|
||||
public static Dictionary<TKey, TElement> ToDictionary<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeyElementSelectors(source, keySelector, elementSelector);
|
||||
if (comparer == null)
|
||||
{
|
||||
comparer = EqualityComparer<TKey>.Default;
|
||||
}
|
||||
Dictionary<TKey, TElement> dictionary = new Dictionary<TKey, TElement>(comparer);
|
||||
foreach (TSource tsource in source)
|
||||
{
|
||||
dictionary.Add(keySelector(tsource), elementSelector(tsource));
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Collections.Generic.Dictionary`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to a specified key selector function.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.Generic.Dictionary`2" /> that contains keys and values.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Collections.Generic.Dictionary`2" /> from.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.-or-<paramref name="keySelector" /> produces a key that is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="keySelector" /> produces duplicate keys for two elements.</exception>
|
||||
// Token: 0x06000344 RID: 836 RVA: 0x0001045C File Offset: 0x0000E65C
|
||||
public static Dictionary<TKey, TSource> ToDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
||||
{
|
||||
return source.ToDictionary(keySelector, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Collections.Generic.Dictionary`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to a specified key selector function and key comparer.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.Generic.Dictionary`2" /> that contains keys and values.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Collections.Generic.Dictionary`2" /> from.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the keys returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.-or-<paramref name="keySelector" /> produces a key that is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="keySelector" /> produces duplicate keys for two elements.</exception>
|
||||
// Token: 0x06000345 RID: 837 RVA: 0x00010468 File Offset: 0x0000E668
|
||||
public static Dictionary<TKey, TSource> ToDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
return source.ToDictionary(keySelector, Enumerable.Function<TSource>.Identity, comparer);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Collections.Generic.List`1" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" />.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.Generic.List`1" /> that contains elements from the input sequence.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Collections.Generic.List`1" /> from.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x06000346 RID: 838 RVA: 0x00010478 File Offset: 0x0000E678
|
||||
public static List<TSource> ToList<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return new List<TSource>(source);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Lookup`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to a specified key selector function.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Lookup`2" /> that contains keys and values.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Linq.Lookup`2" /> from.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x06000347 RID: 839 RVA: 0x00010488 File Offset: 0x0000E688
|
||||
public static ILookup<TKey, TSource> ToLookup<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
|
||||
{
|
||||
return source.ToLookup(keySelector, Enumerable.Function<TSource>.Identity, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Lookup`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to a specified key selector function and key comparer.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Lookup`2" /> that contains keys and values.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Linq.Lookup`2" /> from.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x06000348 RID: 840 RVA: 0x00010498 File Offset: 0x0000E698
|
||||
public static ILookup<TKey, TSource> ToLookup<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
return source.ToLookup(keySelector, (TSource element) => element, comparer);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Lookup`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to specified key selector and element selector functions.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Lookup`2" /> that contains values of type <paramref name="TElement" /> selected from the input sequence.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Linq.Lookup`2" /> from.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the value returned by <paramref name="elementSelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> is null.</exception>
|
||||
// Token: 0x06000349 RID: 841 RVA: 0x000104B0 File Offset: 0x0000E6B0
|
||||
public static ILookup<TKey, TElement> ToLookup<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector)
|
||||
{
|
||||
return source.ToLookup(keySelector, elementSelector, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Lookup`2" /> from an <see cref="T:System.Collections.Generic.IEnumerable`1" /> according to a specified key selector function, a comparer and an element selector function.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Lookup`2" /> that contains values of type <paramref name="TElement" /> selected from the input sequence.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Collections.Generic.IEnumerable`1" /> to create a <see cref="T:System.Linq.Lookup`2" /> from.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <param name="elementSelector">A transform function to produce a result element value from each element.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the value returned by <paramref name="elementSelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> is null.</exception>
|
||||
// Token: 0x0600034A RID: 842 RVA: 0x000104BC File Offset: 0x0000E6BC
|
||||
public static ILookup<TKey, TElement> ToLookup<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeyElementSelectors(source, keySelector, elementSelector);
|
||||
List<TElement> list = null;
|
||||
Dictionary<TKey, List<TElement>> dictionary = new Dictionary<TKey, List<TElement>>(comparer ?? EqualityComparer<TKey>.Default);
|
||||
foreach (TSource tsource in source)
|
||||
{
|
||||
TKey tkey = keySelector(tsource);
|
||||
List<TElement> list2;
|
||||
if (tkey == null)
|
||||
{
|
||||
if (list == null)
|
||||
{
|
||||
list = new List<TElement>();
|
||||
}
|
||||
list2 = list;
|
||||
}
|
||||
else if (!dictionary.TryGetValue(tkey, out list2))
|
||||
{
|
||||
list2 = new List<TElement>();
|
||||
dictionary.Add(tkey, list2);
|
||||
}
|
||||
list2.Add(elementSelector(tsource));
|
||||
}
|
||||
return new Lookup<TKey, TElement>(dictionary, list);
|
||||
}
|
||||
|
||||
/// <summary>Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type.</summary>
|
||||
/// <returns>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.</returns>
|
||||
/// <param name="first">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to compare to <paramref name="second" />.</param>
|
||||
/// <param name="second">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to compare to the first sequence.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
|
||||
// Token: 0x0600034B RID: 843 RVA: 0x00010590 File Offset: 0x0000E790
|
||||
public static bool SequenceEqual<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second)
|
||||
{
|
||||
return first.SequenceEqual(second, null);
|
||||
}
|
||||
|
||||
/// <summary>Determines whether two sequences are equal by comparing their elements by using a specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" />.</summary>
|
||||
/// <returns>true if the two source sequences are of equal length and their corresponding elements compare equal according to <paramref name="comparer" />; otherwise, false.</returns>
|
||||
/// <param name="first">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to compare to <paramref name="second" />.</param>
|
||||
/// <param name="second">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to compare to the first sequence.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to use to compare elements.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
|
||||
// Token: 0x0600034C RID: 844 RVA: 0x0001059C File Offset: 0x0000E79C
|
||||
public static bool SequenceEqual<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
Check.FirstAndSecond(first, second);
|
||||
if (comparer == null)
|
||||
{
|
||||
comparer = EqualityComparer<TSource>.Default;
|
||||
}
|
||||
bool flag;
|
||||
using (IEnumerator<TSource> enumerator = first.GetEnumerator())
|
||||
{
|
||||
using (IEnumerator<TSource> 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;
|
||||
}
|
||||
|
||||
/// <summary>Produces the union of two sequences by using the default equality comparer.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements from both input sequences, excluding duplicates.</returns>
|
||||
/// <param name="first">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements form the first set for the union.</param>
|
||||
/// <param name="second">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements form the second set for the union.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
|
||||
// Token: 0x0600034D RID: 845 RVA: 0x00010674 File Offset: 0x0000E874
|
||||
public static IEnumerable<TSource> Union<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second)
|
||||
{
|
||||
Check.FirstAndSecond(first, second);
|
||||
return first.Union(second, null);
|
||||
}
|
||||
|
||||
/// <summary>Produces the set union of two sequences by using a specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" />.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the elements from both input sequences, excluding duplicates.</returns>
|
||||
/// <param name="first">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements form the first set for the union.</param>
|
||||
/// <param name="second">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements form the second set for the union.</param>
|
||||
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="first" /> or <paramref name="second" /> is null.</exception>
|
||||
// Token: 0x0600034E RID: 846 RVA: 0x00010688 File Offset: 0x0000E888
|
||||
public static IEnumerable<TSource> Union<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
Check.FirstAndSecond(first, second);
|
||||
if (comparer == null)
|
||||
{
|
||||
comparer = EqualityComparer<TSource>.Default;
|
||||
}
|
||||
return Enumerable.CreateUnionIterator<TSource>(first, second, comparer);
|
||||
}
|
||||
|
||||
// Token: 0x0600034F RID: 847 RVA: 0x000106A8 File Offset: 0x0000E8A8
|
||||
private static IEnumerable<TSource> CreateUnionIterator<TSource>(IEnumerable<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
HashSet<TSource> items = new HashSet<TSource>(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;
|
||||
}
|
||||
|
||||
/// <summary>Filters a sequence of values based on a predicate.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains elements from the input sequence that satisfy the condition.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to filter.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x06000350 RID: 848 RVA: 0x000106F0 File Offset: 0x0000E8F0
|
||||
public static IEnumerable<TSource> Where<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return Enumerable.CreateWhereIterator<TSource>(source, predicate);
|
||||
}
|
||||
|
||||
// Token: 0x06000351 RID: 849 RVA: 0x00010700 File Offset: 0x0000E900
|
||||
private static IEnumerable<TSource> CreateWhereIterator<TSource>(IEnumerable<TSource> source, Func<TSource, bool> predicate)
|
||||
{
|
||||
foreach (TSource element in source)
|
||||
{
|
||||
if (predicate(element))
|
||||
{
|
||||
yield return element;
|
||||
}
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function.</summary>
|
||||
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains elements from the input sequence that satisfy the condition.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> to filter.</param>
|
||||
/// <param name="predicate">A function to test each source element for a condition; the second parameter of the function represents the index of the source element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x06000352 RID: 850 RVA: 0x00010738 File Offset: 0x0000E938
|
||||
public static IEnumerable<TSource> Where<TSource>(this IEnumerable<TSource> source, Func<TSource, int, bool> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.CreateWhereIterator(predicate);
|
||||
}
|
||||
|
||||
// Token: 0x06000353 RID: 851 RVA: 0x00010748 File Offset: 0x0000E948
|
||||
private static IEnumerable<TSource> CreateWhereIterator<TSource>(this IEnumerable<TSource> source, Func<TSource, int, bool> 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<TSource> ToReadOnlyCollection<TSource>(this IEnumerable<TSource> source)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
return Enumerable.ReadOnlyCollectionOf<TSource>.Empty;
|
||||
}
|
||||
ReadOnlyCollection<TSource> readOnlyCollection = source as ReadOnlyCollection<TSource>;
|
||||
if (readOnlyCollection != null)
|
||||
{
|
||||
return readOnlyCollection;
|
||||
}
|
||||
return new ReadOnlyCollection<TSource>(source.ToArray<TSource>());
|
||||
}
|
||||
|
||||
// Token: 0x02000033 RID: 51
|
||||
private enum Fallback
|
||||
{
|
||||
// Token: 0x040000E2 RID: 226
|
||||
Default,
|
||||
// Token: 0x040000E3 RID: 227
|
||||
Throw
|
||||
}
|
||||
|
||||
// Token: 0x02000034 RID: 52
|
||||
private class Function<T>
|
||||
{
|
||||
// Token: 0x040000E4 RID: 228
|
||||
public static readonly Func<T, T> Identity = (T t) => t;
|
||||
}
|
||||
|
||||
// Token: 0x02000035 RID: 53
|
||||
private class ReadOnlyCollectionOf<T>
|
||||
{
|
||||
// Token: 0x040000E6 RID: 230
|
||||
public static readonly ReadOnlyCollection<T> Empty = new ReadOnlyCollection<T>(new T[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,825 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents an expression that has a binary operator.</summary>
|
||||
// Token: 0x02000015 RID: 21
|
||||
public sealed class BinaryExpression : Expression
|
||||
{
|
||||
// Token: 0x06000131 RID: 305 RVA: 0x000077B4 File Offset: 0x000059B4
|
||||
internal BinaryExpression(ExpressionType node_type, Type type, Expression left, Expression right)
|
||||
: base(node_type, type)
|
||||
{
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
// Token: 0x06000132 RID: 306 RVA: 0x000077D0 File Offset: 0x000059D0
|
||||
internal BinaryExpression(ExpressionType node_type, Type type, Expression left, Expression right, MethodInfo method)
|
||||
: base(node_type, type)
|
||||
{
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
// Token: 0x06000133 RID: 307 RVA: 0x000077F4 File Offset: 0x000059F4
|
||||
internal BinaryExpression(ExpressionType node_type, Type type, Expression left, Expression right, bool lift_to_null, bool is_lifted, MethodInfo method, LambdaExpression conversion)
|
||||
: base(node_type, type)
|
||||
{
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
this.method = method;
|
||||
this.conversion = conversion;
|
||||
this.lift_to_null = lift_to_null;
|
||||
this.is_lifted = is_lifted;
|
||||
}
|
||||
|
||||
/// <summary>Gets the left operand of the binary operation.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the left operand of the binary operation.</returns>
|
||||
// Token: 0x17000011 RID: 17
|
||||
// (get) Token: 0x06000134 RID: 308 RVA: 0x00007830 File Offset: 0x00005A30
|
||||
public Expression Left
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.left;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the right operand of the binary operation.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the right operand of the binary operation.</returns>
|
||||
// Token: 0x17000012 RID: 18
|
||||
// (get) Token: 0x06000135 RID: 309 RVA: 0x00007838 File Offset: 0x00005A38
|
||||
public Expression Right
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.right;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the implementing method for the binary operation.</summary>
|
||||
/// <returns>The <see cref="T:System.Reflection.MethodInfo" /> that represents the implementing method.</returns>
|
||||
// Token: 0x17000013 RID: 19
|
||||
// (get) Token: 0x06000136 RID: 310 RVA: 0x00007840 File Offset: 0x00005A40
|
||||
public MethodInfo Method
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.method;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value that indicates whether the expression tree node represents a lifted call to an operator.</summary>
|
||||
/// <returns>true if the node represents a lifted call; otherwise, false.</returns>
|
||||
// Token: 0x17000014 RID: 20
|
||||
// (get) Token: 0x06000137 RID: 311 RVA: 0x00007848 File Offset: 0x00005A48
|
||||
public bool IsLifted
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.is_lifted;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value that indicates whether the expression tree node represents a lifted call to an operator whose return type is lifted to a nullable type.</summary>
|
||||
/// <returns>true if the operator's return type is lifted to a nullable type; otherwise, false.</returns>
|
||||
// Token: 0x17000015 RID: 21
|
||||
// (get) Token: 0x06000138 RID: 312 RVA: 0x00007850 File Offset: 0x00005A50
|
||||
public bool IsLiftedToNull
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.lift_to_null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the type conversion function that is used by a coalescing operation.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.LambdaExpression" /> that represents a type conversion function.</returns>
|
||||
// Token: 0x17000016 RID: 22
|
||||
// (get) Token: 0x06000139 RID: 313 RVA: 0x00007858 File Offset: 0x00005A58
|
||||
public LambdaExpression Conversion
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.conversion;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600013A RID: 314 RVA: 0x00007860 File Offset: 0x00005A60
|
||||
private void EmitArrayAccess(EmitContext ec)
|
||||
{
|
||||
this.left.Emit(ec);
|
||||
this.right.Emit(ec);
|
||||
ec.ig.Emit(OpCodes.Ldelem, base.Type);
|
||||
}
|
||||
|
||||
// Token: 0x0600013B RID: 315 RVA: 0x0000789C File Offset: 0x00005A9C
|
||||
private void EmitLogicalBinary(EmitContext ec)
|
||||
{
|
||||
ExpressionType nodeType = base.NodeType;
|
||||
if (nodeType != ExpressionType.And)
|
||||
{
|
||||
if (nodeType != ExpressionType.AndAlso)
|
||||
{
|
||||
if (nodeType == ExpressionType.Or)
|
||||
{
|
||||
goto IL_2A;
|
||||
}
|
||||
if (nodeType != ExpressionType.OrElse)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!this.IsLifted)
|
||||
{
|
||||
this.EmitLogicalShortCircuit(ec);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EmitLiftedLogicalShortCircuit(ec);
|
||||
}
|
||||
return;
|
||||
}
|
||||
IL_2A:
|
||||
if (!this.IsLifted)
|
||||
{
|
||||
this.EmitLogical(ec);
|
||||
}
|
||||
else if (base.Type == typeof(bool?))
|
||||
{
|
||||
this.EmitLiftedLogical(ec);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EmitLiftedArithmeticBinary(ec);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600013C RID: 316 RVA: 0x0000793C File Offset: 0x00005B3C
|
||||
private void EmitLogical(EmitContext ec)
|
||||
{
|
||||
this.EmitNonLiftedBinary(ec);
|
||||
}
|
||||
|
||||
// Token: 0x0600013D RID: 317 RVA: 0x00007948 File Offset: 0x00005B48
|
||||
private void EmitLiftedLogical(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
bool flag = base.NodeType == ExpressionType.And;
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.left);
|
||||
LocalBuilder localBuilder2 = ec.EmitStored(this.right);
|
||||
Label label = ig.DefineLabel();
|
||||
Label label2 = ig.DefineLabel();
|
||||
Label label3 = ig.DefineLabel();
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder);
|
||||
ig.Emit(OpCodes.Brtrue, label);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder2);
|
||||
ig.Emit(OpCodes.Brtrue, label2);
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
ig.Emit(OpCodes.Brfalse, label);
|
||||
ig.MarkLabel(label2);
|
||||
ec.EmitLoad((!flag) ? localBuilder2 : localBuilder);
|
||||
ig.Emit(OpCodes.Br, label3);
|
||||
ig.MarkLabel(label);
|
||||
ec.EmitLoad((!flag) ? localBuilder : localBuilder2);
|
||||
ig.MarkLabel(label3);
|
||||
}
|
||||
|
||||
// Token: 0x0600013E RID: 318 RVA: 0x00007A20 File Offset: 0x00005C20
|
||||
private void EmitLogicalShortCircuit(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
bool flag = base.NodeType == ExpressionType.AndAlso;
|
||||
Label label = ig.DefineLabel();
|
||||
Label label2 = ig.DefineLabel();
|
||||
ec.Emit(this.left);
|
||||
ig.Emit((!flag) ? OpCodes.Brtrue : OpCodes.Brfalse, label);
|
||||
ec.Emit(this.right);
|
||||
ig.Emit(OpCodes.Br, label2);
|
||||
ig.MarkLabel(label);
|
||||
ig.Emit((!flag) ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0);
|
||||
ig.MarkLabel(label2);
|
||||
}
|
||||
|
||||
// Token: 0x0600013F RID: 319 RVA: 0x00007AB8 File Offset: 0x00005CB8
|
||||
private MethodInfo GetFalseOperator()
|
||||
{
|
||||
return Expression.GetFalseOperator(this.left.Type.GetNotNullableType());
|
||||
}
|
||||
|
||||
// Token: 0x06000140 RID: 320 RVA: 0x00007AD0 File Offset: 0x00005CD0
|
||||
private MethodInfo GetTrueOperator()
|
||||
{
|
||||
return Expression.GetTrueOperator(this.left.Type.GetNotNullableType());
|
||||
}
|
||||
|
||||
// Token: 0x06000141 RID: 321 RVA: 0x00007AE8 File Offset: 0x00005CE8
|
||||
private void EmitUserDefinedLogicalShortCircuit(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
bool flag = base.NodeType == ExpressionType.AndAlso;
|
||||
Label label = ig.DefineLabel();
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.left);
|
||||
ec.EmitLoad(localBuilder);
|
||||
ig.Emit(OpCodes.Dup);
|
||||
ec.EmitCall((!flag) ? this.GetTrueOperator() : this.GetFalseOperator());
|
||||
ig.Emit(OpCodes.Brtrue, label);
|
||||
ec.Emit(this.right);
|
||||
ec.EmitCall(this.method);
|
||||
ig.MarkLabel(label);
|
||||
}
|
||||
|
||||
// Token: 0x06000142 RID: 322 RVA: 0x00007B74 File Offset: 0x00005D74
|
||||
private void EmitLiftedLogicalShortCircuit(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
bool flag = base.NodeType == ExpressionType.AndAlso;
|
||||
Label label = ig.DefineLabel();
|
||||
Label label2 = ig.DefineLabel();
|
||||
Label label3 = ig.DefineLabel();
|
||||
Label label4 = ig.DefineLabel();
|
||||
Label label5 = ig.DefineLabel();
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.left);
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
ig.Emit(OpCodes.Brfalse, label);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder);
|
||||
ig.Emit(OpCodes.Ldc_I4_0);
|
||||
ig.Emit(OpCodes.Ceq);
|
||||
ig.Emit((!flag) ? OpCodes.Brfalse : OpCodes.Brtrue, label2);
|
||||
ig.MarkLabel(label);
|
||||
LocalBuilder localBuilder2 = ec.EmitStored(this.right);
|
||||
ec.EmitNullableHasValue(localBuilder2);
|
||||
ig.Emit(OpCodes.Brfalse_S, label3);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder2);
|
||||
ig.Emit(OpCodes.Ldc_I4_0);
|
||||
ig.Emit(OpCodes.Ceq);
|
||||
ig.Emit((!flag) ? OpCodes.Brfalse : OpCodes.Brtrue, label2);
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
ig.Emit(OpCodes.Brfalse, label3);
|
||||
ig.Emit((!flag) ? OpCodes.Ldc_I4_0 : OpCodes.Ldc_I4_1);
|
||||
ig.Emit(OpCodes.Br_S, label4);
|
||||
ig.MarkLabel(label2);
|
||||
ig.Emit((!flag) ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0);
|
||||
ig.MarkLabel(label4);
|
||||
ec.EmitNullableNew(base.Type);
|
||||
ig.Emit(OpCodes.Br, label5);
|
||||
ig.MarkLabel(label3);
|
||||
LocalBuilder localBuilder3 = ig.DeclareLocal(base.Type);
|
||||
ec.EmitNullableInitialize(localBuilder3);
|
||||
ig.MarkLabel(label5);
|
||||
}
|
||||
|
||||
// Token: 0x06000143 RID: 323 RVA: 0x00007D20 File Offset: 0x00005F20
|
||||
private void EmitCoalesce(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
Label label = ig.DefineLabel();
|
||||
Label label2 = ig.DefineLabel();
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.left);
|
||||
bool flag = localBuilder.LocalType.IsNullable();
|
||||
if (flag)
|
||||
{
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.EmitLoad(localBuilder);
|
||||
}
|
||||
ig.Emit(OpCodes.Brfalse, label2);
|
||||
if (flag && !base.Type.IsNullable())
|
||||
{
|
||||
ec.EmitNullableGetValue(localBuilder);
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.EmitLoad(localBuilder);
|
||||
}
|
||||
ig.Emit(OpCodes.Br, label);
|
||||
ig.MarkLabel(label2);
|
||||
ec.Emit(this.right);
|
||||
ig.MarkLabel(label);
|
||||
}
|
||||
|
||||
// Token: 0x06000144 RID: 324 RVA: 0x00007DD4 File Offset: 0x00005FD4
|
||||
private void EmitConvertedCoalesce(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
Label label = ig.DefineLabel();
|
||||
Label label2 = ig.DefineLabel();
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.left);
|
||||
if (localBuilder.LocalType.IsNullable())
|
||||
{
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.EmitLoad(localBuilder);
|
||||
}
|
||||
ig.Emit(OpCodes.Brfalse, label2);
|
||||
ec.Emit(this.conversion);
|
||||
ec.EmitLoad(localBuilder);
|
||||
ig.Emit(OpCodes.Callvirt, this.conversion.Type.GetInvokeMethod());
|
||||
ig.Emit(OpCodes.Br, label);
|
||||
ig.MarkLabel(label2);
|
||||
ec.Emit(this.right);
|
||||
ig.MarkLabel(label);
|
||||
}
|
||||
|
||||
// Token: 0x06000145 RID: 325 RVA: 0x00007E88 File Offset: 0x00006088
|
||||
private static bool IsInt32OrInt64(Type type)
|
||||
{
|
||||
return type == typeof(int) || type == typeof(long);
|
||||
}
|
||||
|
||||
// Token: 0x06000146 RID: 326 RVA: 0x00007EB8 File Offset: 0x000060B8
|
||||
private static bool IsSingleOrDouble(Type type)
|
||||
{
|
||||
return type == typeof(float) || type == typeof(double);
|
||||
}
|
||||
|
||||
// Token: 0x06000147 RID: 327 RVA: 0x00007EE8 File Offset: 0x000060E8
|
||||
private void EmitBinaryOperator(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
bool flag = Expression.IsUnsigned(this.left.Type);
|
||||
ExpressionType nodeType = base.NodeType;
|
||||
switch (nodeType)
|
||||
{
|
||||
case ExpressionType.Divide:
|
||||
ig.Emit((!flag) ? OpCodes.Div : OpCodes.Div_Un);
|
||||
break;
|
||||
case ExpressionType.Equal:
|
||||
ig.Emit(OpCodes.Ceq);
|
||||
break;
|
||||
case ExpressionType.ExclusiveOr:
|
||||
ig.Emit(OpCodes.Xor);
|
||||
break;
|
||||
case ExpressionType.GreaterThan:
|
||||
ig.Emit((!flag) ? OpCodes.Cgt : OpCodes.Cgt_Un);
|
||||
break;
|
||||
case ExpressionType.GreaterThanOrEqual:
|
||||
if (flag || BinaryExpression.IsSingleOrDouble(this.left.Type))
|
||||
{
|
||||
ig.Emit(OpCodes.Clt_Un);
|
||||
}
|
||||
else
|
||||
{
|
||||
ig.Emit(OpCodes.Clt);
|
||||
}
|
||||
ig.Emit(OpCodes.Ldc_I4_0);
|
||||
ig.Emit(OpCodes.Ceq);
|
||||
break;
|
||||
default:
|
||||
switch (nodeType)
|
||||
{
|
||||
case ExpressionType.Add:
|
||||
ig.Emit(OpCodes.Add);
|
||||
break;
|
||||
case ExpressionType.AddChecked:
|
||||
if (BinaryExpression.IsInt32OrInt64(this.left.Type))
|
||||
{
|
||||
ig.Emit(OpCodes.Add_Ovf);
|
||||
}
|
||||
else
|
||||
{
|
||||
ig.Emit((!flag) ? OpCodes.Add : OpCodes.Add_Ovf_Un);
|
||||
}
|
||||
break;
|
||||
case ExpressionType.And:
|
||||
ig.Emit(OpCodes.And);
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException(string.Format("Internal error: BinaryExpression contains non-Binary nodetype {0}", base.NodeType));
|
||||
}
|
||||
break;
|
||||
case ExpressionType.LeftShift:
|
||||
case ExpressionType.RightShift:
|
||||
ig.Emit(OpCodes.Ldc_I4, (this.left.Type != typeof(int)) ? 63 : 31);
|
||||
ig.Emit(OpCodes.And);
|
||||
if (base.NodeType == ExpressionType.RightShift)
|
||||
{
|
||||
ig.Emit((!flag) ? OpCodes.Shr : OpCodes.Shr_Un);
|
||||
}
|
||||
else
|
||||
{
|
||||
ig.Emit(OpCodes.Shl);
|
||||
}
|
||||
break;
|
||||
case ExpressionType.LessThan:
|
||||
ig.Emit((!flag) ? OpCodes.Clt : OpCodes.Clt_Un);
|
||||
break;
|
||||
case ExpressionType.LessThanOrEqual:
|
||||
if (flag || BinaryExpression.IsSingleOrDouble(this.left.Type))
|
||||
{
|
||||
ig.Emit(OpCodes.Cgt_Un);
|
||||
}
|
||||
else
|
||||
{
|
||||
ig.Emit(OpCodes.Cgt);
|
||||
}
|
||||
ig.Emit(OpCodes.Ldc_I4_0);
|
||||
ig.Emit(OpCodes.Ceq);
|
||||
break;
|
||||
case ExpressionType.Modulo:
|
||||
ig.Emit((!flag) ? OpCodes.Rem : OpCodes.Rem_Un);
|
||||
break;
|
||||
case ExpressionType.Multiply:
|
||||
ig.Emit(OpCodes.Mul);
|
||||
break;
|
||||
case ExpressionType.MultiplyChecked:
|
||||
if (BinaryExpression.IsInt32OrInt64(this.left.Type))
|
||||
{
|
||||
ig.Emit(OpCodes.Mul_Ovf);
|
||||
}
|
||||
else
|
||||
{
|
||||
ig.Emit((!flag) ? OpCodes.Mul : OpCodes.Mul_Ovf_Un);
|
||||
}
|
||||
break;
|
||||
case ExpressionType.NotEqual:
|
||||
ig.Emit(OpCodes.Ceq);
|
||||
ig.Emit(OpCodes.Ldc_I4_0);
|
||||
ig.Emit(OpCodes.Ceq);
|
||||
break;
|
||||
case ExpressionType.Or:
|
||||
ig.Emit(OpCodes.Or);
|
||||
break;
|
||||
case ExpressionType.Power:
|
||||
ig.Emit(OpCodes.Call, typeof(Math).GetMethod("Pow"));
|
||||
break;
|
||||
case ExpressionType.Subtract:
|
||||
ig.Emit(OpCodes.Sub);
|
||||
break;
|
||||
case ExpressionType.SubtractChecked:
|
||||
if (BinaryExpression.IsInt32OrInt64(this.left.Type))
|
||||
{
|
||||
ig.Emit(OpCodes.Sub_Ovf);
|
||||
}
|
||||
else
|
||||
{
|
||||
ig.Emit((!flag) ? OpCodes.Sub : OpCodes.Sub_Ovf_Un);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000148 RID: 328 RVA: 0x000082F0 File Offset: 0x000064F0
|
||||
private bool IsLeftLiftedBinary()
|
||||
{
|
||||
return this.left.Type.IsNullable() && !this.right.Type.IsNullable();
|
||||
}
|
||||
|
||||
// Token: 0x06000149 RID: 329 RVA: 0x00008328 File Offset: 0x00006528
|
||||
private void EmitLeftLiftedToNullBinary(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
Label label = ig.DefineLabel();
|
||||
Label label2 = ig.DefineLabel();
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.left);
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
ig.Emit(OpCodes.Brfalse, label);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder);
|
||||
ec.Emit(this.right);
|
||||
this.EmitBinaryOperator(ec);
|
||||
ec.EmitNullableNew(base.Type);
|
||||
ig.Emit(OpCodes.Br, label2);
|
||||
ig.MarkLabel(label);
|
||||
LocalBuilder localBuilder2 = ig.DeclareLocal(base.Type);
|
||||
ec.EmitNullableInitialize(localBuilder2);
|
||||
ig.MarkLabel(label2);
|
||||
}
|
||||
|
||||
// Token: 0x0600014A RID: 330 RVA: 0x000083C0 File Offset: 0x000065C0
|
||||
private void EmitLiftedArithmeticBinary(EmitContext ec)
|
||||
{
|
||||
if (this.IsLeftLiftedBinary())
|
||||
{
|
||||
this.EmitLeftLiftedToNullBinary(ec);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EmitLiftedToNullBinary(ec);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600014B RID: 331 RVA: 0x000083E0 File Offset: 0x000065E0
|
||||
private void EmitLiftedToNullBinary(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.left);
|
||||
LocalBuilder localBuilder2 = ec.EmitStored(this.right);
|
||||
LocalBuilder localBuilder3 = ig.DeclareLocal(base.Type);
|
||||
Label label = ig.DefineLabel();
|
||||
Label label2 = ig.DefineLabel();
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
ec.EmitNullableHasValue(localBuilder2);
|
||||
ig.Emit(OpCodes.And);
|
||||
ig.Emit(OpCodes.Brtrue, label);
|
||||
ec.EmitNullableInitialize(localBuilder3);
|
||||
ig.Emit(OpCodes.Br, label2);
|
||||
ig.MarkLabel(label);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder2);
|
||||
this.EmitBinaryOperator(ec);
|
||||
ec.EmitNullableNew(localBuilder3.LocalType);
|
||||
ig.MarkLabel(label2);
|
||||
}
|
||||
|
||||
// Token: 0x0600014C RID: 332 RVA: 0x00008498 File Offset: 0x00006698
|
||||
private void EmitLiftedRelationalBinary(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.left);
|
||||
LocalBuilder localBuilder2 = ec.EmitStored(this.right);
|
||||
Label label = ig.DefineLabel();
|
||||
Label label2 = ig.DefineLabel();
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder2);
|
||||
ExpressionType expressionType = base.NodeType;
|
||||
if (expressionType != ExpressionType.Equal && expressionType != ExpressionType.NotEqual)
|
||||
{
|
||||
this.EmitBinaryOperator(ec);
|
||||
ig.Emit(OpCodes.Brfalse, label);
|
||||
}
|
||||
else
|
||||
{
|
||||
ig.Emit(OpCodes.Bne_Un, label);
|
||||
}
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
ec.EmitNullableHasValue(localBuilder2);
|
||||
expressionType = base.NodeType;
|
||||
if (expressionType != ExpressionType.Equal)
|
||||
{
|
||||
if (expressionType != ExpressionType.NotEqual)
|
||||
{
|
||||
ig.Emit(OpCodes.And);
|
||||
}
|
||||
else
|
||||
{
|
||||
ig.Emit(OpCodes.Ceq);
|
||||
ig.Emit(OpCodes.Ldc_I4_0);
|
||||
ig.Emit(OpCodes.Ceq);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ig.Emit(OpCodes.Ceq);
|
||||
}
|
||||
ig.Emit(OpCodes.Br, label2);
|
||||
ig.MarkLabel(label);
|
||||
ig.Emit((base.NodeType != ExpressionType.NotEqual) ? OpCodes.Ldc_I4_0 : OpCodes.Ldc_I4_1);
|
||||
ig.MarkLabel(label2);
|
||||
}
|
||||
|
||||
// Token: 0x0600014D RID: 333 RVA: 0x000085DC File Offset: 0x000067DC
|
||||
private void EmitArithmeticBinary(EmitContext ec)
|
||||
{
|
||||
if (!this.IsLifted)
|
||||
{
|
||||
this.EmitNonLiftedBinary(ec);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EmitLiftedArithmeticBinary(ec);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600014E RID: 334 RVA: 0x000085FC File Offset: 0x000067FC
|
||||
private void EmitNonLiftedBinary(EmitContext ec)
|
||||
{
|
||||
ec.Emit(this.left);
|
||||
ec.Emit(this.right);
|
||||
this.EmitBinaryOperator(ec);
|
||||
}
|
||||
|
||||
// Token: 0x0600014F RID: 335 RVA: 0x00008620 File Offset: 0x00006820
|
||||
private void EmitRelationalBinary(EmitContext ec)
|
||||
{
|
||||
if (!this.IsLifted)
|
||||
{
|
||||
this.EmitNonLiftedBinary(ec);
|
||||
}
|
||||
else if (this.IsLiftedToNull)
|
||||
{
|
||||
this.EmitLiftedToNullBinary(ec);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EmitLiftedRelationalBinary(ec);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000150 RID: 336 RVA: 0x00008664 File Offset: 0x00006864
|
||||
private void EmitLiftedUserDefinedOperator(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
Label label = ig.DefineLabel();
|
||||
Label label2 = ig.DefineLabel();
|
||||
Label label3 = ig.DefineLabel();
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.left);
|
||||
LocalBuilder localBuilder2 = ec.EmitStored(this.right);
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
ec.EmitNullableHasValue(localBuilder2);
|
||||
ExpressionType nodeType = base.NodeType;
|
||||
if (nodeType != ExpressionType.Equal)
|
||||
{
|
||||
if (nodeType != ExpressionType.NotEqual)
|
||||
{
|
||||
ig.Emit(OpCodes.And);
|
||||
ig.Emit(OpCodes.Brfalse, label2);
|
||||
}
|
||||
else
|
||||
{
|
||||
ig.Emit(OpCodes.Bne_Un, label);
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
ig.Emit(OpCodes.Brfalse, label2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ig.Emit(OpCodes.Bne_Un, label2);
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
ig.Emit(OpCodes.Brfalse, label);
|
||||
}
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder2);
|
||||
ec.EmitCall(this.method);
|
||||
ig.Emit(OpCodes.Br, label3);
|
||||
ig.MarkLabel(label);
|
||||
ig.Emit(OpCodes.Ldc_I4_1);
|
||||
ig.Emit(OpCodes.Br, label3);
|
||||
ig.MarkLabel(label2);
|
||||
ig.Emit(OpCodes.Ldc_I4_0);
|
||||
ig.Emit(OpCodes.Br, label3);
|
||||
ig.MarkLabel(label3);
|
||||
}
|
||||
|
||||
// Token: 0x06000151 RID: 337 RVA: 0x000087AC File Offset: 0x000069AC
|
||||
private void EmitLiftedToNullUserDefinedOperator(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
Label label = ig.DefineLabel();
|
||||
Label label2 = ig.DefineLabel();
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.left);
|
||||
LocalBuilder localBuilder2 = ec.EmitStored(this.right);
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
ec.EmitNullableHasValue(localBuilder2);
|
||||
ig.Emit(OpCodes.And);
|
||||
ig.Emit(OpCodes.Brfalse, label);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder2);
|
||||
ec.EmitCall(this.method);
|
||||
ec.EmitNullableNew(base.Type);
|
||||
ig.Emit(OpCodes.Br, label2);
|
||||
ig.MarkLabel(label);
|
||||
LocalBuilder localBuilder3 = ig.DeclareLocal(base.Type);
|
||||
ec.EmitNullableInitialize(localBuilder3);
|
||||
ig.MarkLabel(label2);
|
||||
}
|
||||
|
||||
// Token: 0x06000152 RID: 338 RVA: 0x00008868 File Offset: 0x00006A68
|
||||
private void EmitUserDefinedLiftedLogicalShortCircuit(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
bool flag = base.NodeType == ExpressionType.AndAlso;
|
||||
Label label = ig.DefineLabel();
|
||||
Label label2 = ig.DefineLabel();
|
||||
Label label3 = ig.DefineLabel();
|
||||
Label label4 = ig.DefineLabel();
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.left);
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
ig.Emit(OpCodes.Brfalse, (!flag) ? label : label3);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder);
|
||||
ec.EmitCall((!flag) ? this.GetTrueOperator() : this.GetFalseOperator());
|
||||
ig.Emit(OpCodes.Brtrue, label2);
|
||||
ig.MarkLabel(label);
|
||||
LocalBuilder localBuilder2 = ec.EmitStored(this.right);
|
||||
ec.EmitNullableHasValue(localBuilder2);
|
||||
ig.Emit(OpCodes.Brfalse, label3);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder2);
|
||||
ec.EmitCall(this.method);
|
||||
ec.EmitNullableNew(base.Type);
|
||||
ig.Emit(OpCodes.Br, label4);
|
||||
ig.MarkLabel(label2);
|
||||
ec.EmitLoad(localBuilder);
|
||||
ig.Emit(OpCodes.Br, label4);
|
||||
ig.MarkLabel(label3);
|
||||
LocalBuilder localBuilder3 = ig.DeclareLocal(base.Type);
|
||||
ec.EmitNullableInitialize(localBuilder3);
|
||||
ig.MarkLabel(label4);
|
||||
}
|
||||
|
||||
// Token: 0x06000153 RID: 339 RVA: 0x000089A8 File Offset: 0x00006BA8
|
||||
private void EmitUserDefinedOperator(EmitContext ec)
|
||||
{
|
||||
if (!this.IsLifted)
|
||||
{
|
||||
ExpressionType expressionType = base.NodeType;
|
||||
if (expressionType != ExpressionType.AndAlso && expressionType != ExpressionType.OrElse)
|
||||
{
|
||||
this.left.Emit(ec);
|
||||
this.right.Emit(ec);
|
||||
ec.EmitCall(this.method);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EmitUserDefinedLogicalShortCircuit(ec);
|
||||
}
|
||||
}
|
||||
else if (this.IsLiftedToNull)
|
||||
{
|
||||
ExpressionType expressionType = base.NodeType;
|
||||
if (expressionType != ExpressionType.AndAlso && expressionType != ExpressionType.OrElse)
|
||||
{
|
||||
this.EmitLiftedToNullUserDefinedOperator(ec);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EmitUserDefinedLiftedLogicalShortCircuit(ec);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EmitLiftedUserDefinedOperator(ec);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000154 RID: 340 RVA: 0x00008A60 File Offset: 0x00006C60
|
||||
internal override void Emit(EmitContext ec)
|
||||
{
|
||||
if (this.method != null)
|
||||
{
|
||||
this.EmitUserDefinedOperator(ec);
|
||||
return;
|
||||
}
|
||||
switch (base.NodeType)
|
||||
{
|
||||
case ExpressionType.Add:
|
||||
case ExpressionType.AddChecked:
|
||||
case ExpressionType.Divide:
|
||||
case ExpressionType.ExclusiveOr:
|
||||
case ExpressionType.LeftShift:
|
||||
case ExpressionType.Modulo:
|
||||
case ExpressionType.Multiply:
|
||||
case ExpressionType.MultiplyChecked:
|
||||
case ExpressionType.Power:
|
||||
case ExpressionType.RightShift:
|
||||
case ExpressionType.Subtract:
|
||||
case ExpressionType.SubtractChecked:
|
||||
this.EmitArithmeticBinary(ec);
|
||||
return;
|
||||
case ExpressionType.And:
|
||||
case ExpressionType.AndAlso:
|
||||
case ExpressionType.Or:
|
||||
case ExpressionType.OrElse:
|
||||
this.EmitLogicalBinary(ec);
|
||||
return;
|
||||
case ExpressionType.ArrayIndex:
|
||||
this.EmitArrayAccess(ec);
|
||||
return;
|
||||
case ExpressionType.Coalesce:
|
||||
if (this.conversion != null)
|
||||
{
|
||||
this.EmitConvertedCoalesce(ec);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EmitCoalesce(ec);
|
||||
}
|
||||
return;
|
||||
case ExpressionType.Equal:
|
||||
case ExpressionType.GreaterThan:
|
||||
case ExpressionType.GreaterThanOrEqual:
|
||||
case ExpressionType.LessThan:
|
||||
case ExpressionType.LessThanOrEqual:
|
||||
case ExpressionType.NotEqual:
|
||||
this.EmitRelationalBinary(ec);
|
||||
return;
|
||||
}
|
||||
throw new NotSupportedException(base.NodeType.ToString());
|
||||
}
|
||||
|
||||
// Token: 0x04000058 RID: 88
|
||||
private Expression left;
|
||||
|
||||
// Token: 0x04000059 RID: 89
|
||||
private Expression right;
|
||||
|
||||
// Token: 0x0400005A RID: 90
|
||||
private LambdaExpression conversion;
|
||||
|
||||
// Token: 0x0400005B RID: 91
|
||||
private MethodInfo method;
|
||||
|
||||
// Token: 0x0400005C RID: 92
|
||||
private bool lift_to_null;
|
||||
|
||||
// Token: 0x0400005D RID: 93
|
||||
private bool is_lifted;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
// Token: 0x02000019 RID: 25
|
||||
internal class CompilationContext
|
||||
{
|
||||
// Token: 0x06000167 RID: 359 RVA: 0x000091AC File Offset: 0x000073AC
|
||||
public int AddGlobal(object global)
|
||||
{
|
||||
return CompilationContext.AddItemToList<object>(global, this.globals);
|
||||
}
|
||||
|
||||
// Token: 0x06000168 RID: 360 RVA: 0x000091BC File Offset: 0x000073BC
|
||||
public object[] GetGlobals()
|
||||
{
|
||||
return this.globals.ToArray();
|
||||
}
|
||||
|
||||
// Token: 0x06000169 RID: 361 RVA: 0x000091CC File Offset: 0x000073CC
|
||||
private static int AddItemToList<T>(T item, IList<T> list)
|
||||
{
|
||||
list.Add(item);
|
||||
return list.Count - 1;
|
||||
}
|
||||
|
||||
// Token: 0x0600016A RID: 362 RVA: 0x000091E0 File Offset: 0x000073E0
|
||||
public int AddCompilationUnit(LambdaExpression lambda)
|
||||
{
|
||||
this.DetectHoistedVariables(lambda);
|
||||
return this.AddCompilationUnit(null, lambda);
|
||||
}
|
||||
|
||||
// Token: 0x0600016B RID: 363 RVA: 0x000091F4 File Offset: 0x000073F4
|
||||
public int AddCompilationUnit(EmitContext parent, LambdaExpression lambda)
|
||||
{
|
||||
EmitContext emitContext = new EmitContext(this, parent, lambda);
|
||||
int num = CompilationContext.AddItemToList<EmitContext>(emitContext, this.units);
|
||||
emitContext.Emit();
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x0600016C RID: 364 RVA: 0x00009220 File Offset: 0x00007420
|
||||
private void DetectHoistedVariables(LambdaExpression lambda)
|
||||
{
|
||||
this.hoisted_map = new CompilationContext.HoistedVariableDetector().Process(lambda);
|
||||
}
|
||||
|
||||
// Token: 0x0600016D RID: 365 RVA: 0x00009234 File Offset: 0x00007434
|
||||
public List<ParameterExpression> GetHoistedLocals(LambdaExpression lambda)
|
||||
{
|
||||
if (this.hoisted_map == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
List<ParameterExpression> list;
|
||||
this.hoisted_map.TryGetValue(lambda, out list);
|
||||
return list;
|
||||
}
|
||||
|
||||
// Token: 0x0600016E RID: 366 RVA: 0x00009260 File Offset: 0x00007460
|
||||
public object[] CreateHoistedLocals(int unit)
|
||||
{
|
||||
List<ParameterExpression> hoistedLocals = this.GetHoistedLocals(this.units[unit].Lambda);
|
||||
return new object[(hoistedLocals != null) ? hoistedLocals.Count : 0];
|
||||
}
|
||||
|
||||
// Token: 0x0600016F RID: 367 RVA: 0x0000929C File Offset: 0x0000749C
|
||||
public Expression IsolateExpression(ExecutionScope scope, object[] locals, Expression expression)
|
||||
{
|
||||
return new CompilationContext.ParameterReplacer(this, scope, locals).Transform(expression);
|
||||
}
|
||||
|
||||
// Token: 0x06000170 RID: 368 RVA: 0x000092AC File Offset: 0x000074AC
|
||||
public Delegate CreateDelegate()
|
||||
{
|
||||
return this.CreateDelegate(0, new ExecutionScope(this));
|
||||
}
|
||||
|
||||
// Token: 0x06000171 RID: 369 RVA: 0x000092BC File Offset: 0x000074BC
|
||||
public Delegate CreateDelegate(int unit, ExecutionScope scope)
|
||||
{
|
||||
return this.units[unit].CreateDelegate(scope);
|
||||
}
|
||||
|
||||
// Token: 0x04000064 RID: 100
|
||||
private List<object> globals = new List<object>();
|
||||
|
||||
// Token: 0x04000065 RID: 101
|
||||
private List<EmitContext> units = new List<EmitContext>();
|
||||
|
||||
// Token: 0x04000066 RID: 102
|
||||
private Dictionary<LambdaExpression, List<ParameterExpression>> hoisted_map;
|
||||
|
||||
// Token: 0x0200001A RID: 26
|
||||
private class ParameterReplacer : ExpressionTransformer
|
||||
{
|
||||
// Token: 0x06000172 RID: 370 RVA: 0x000092D0 File Offset: 0x000074D0
|
||||
public ParameterReplacer(CompilationContext context, ExecutionScope scope, object[] locals)
|
||||
{
|
||||
this.context = context;
|
||||
this.scope = scope;
|
||||
this.locals = locals;
|
||||
}
|
||||
|
||||
// Token: 0x06000173 RID: 371 RVA: 0x000092F0 File Offset: 0x000074F0
|
||||
protected override Expression VisitParameter(ParameterExpression parameter)
|
||||
{
|
||||
ExecutionScope parent = this.scope;
|
||||
object[] array = this.locals;
|
||||
while (parent != null)
|
||||
{
|
||||
int num = this.IndexOfHoistedLocal(parent, parameter);
|
||||
if (num != -1)
|
||||
{
|
||||
return this.ReadHoistedLocalFromArray(array, num);
|
||||
}
|
||||
array = parent.Locals;
|
||||
parent = parent.Parent;
|
||||
}
|
||||
return parameter;
|
||||
}
|
||||
|
||||
// Token: 0x06000174 RID: 372 RVA: 0x00009340 File Offset: 0x00007540
|
||||
private Expression ReadHoistedLocalFromArray(object[] locals, int position)
|
||||
{
|
||||
return Expression.Field(Expression.Convert(Expression.ArrayIndex(Expression.Constant(locals), Expression.Constant(position)), locals[position].GetType()), "Value");
|
||||
}
|
||||
|
||||
// Token: 0x06000175 RID: 373 RVA: 0x0000937C File Offset: 0x0000757C
|
||||
private int IndexOfHoistedLocal(ExecutionScope scope, ParameterExpression parameter)
|
||||
{
|
||||
return this.context.units[scope.compilation_unit].IndexOfHoistedLocal(parameter);
|
||||
}
|
||||
|
||||
// Token: 0x04000067 RID: 103
|
||||
private CompilationContext context;
|
||||
|
||||
// Token: 0x04000068 RID: 104
|
||||
private ExecutionScope scope;
|
||||
|
||||
// Token: 0x04000069 RID: 105
|
||||
private object[] locals;
|
||||
}
|
||||
|
||||
// Token: 0x0200001B RID: 27
|
||||
private class HoistedVariableDetector : ExpressionVisitor
|
||||
{
|
||||
// Token: 0x06000177 RID: 375 RVA: 0x000093B0 File Offset: 0x000075B0
|
||||
public Dictionary<LambdaExpression, List<ParameterExpression>> Process(LambdaExpression lambda)
|
||||
{
|
||||
this.Visit(lambda);
|
||||
return this.hoisted_map;
|
||||
}
|
||||
|
||||
// Token: 0x06000178 RID: 376 RVA: 0x000093C0 File Offset: 0x000075C0
|
||||
protected override void VisitLambda(LambdaExpression lambda)
|
||||
{
|
||||
this.lambda = lambda;
|
||||
foreach (ParameterExpression parameterExpression in lambda.Parameters)
|
||||
{
|
||||
this.parameter_to_lambda[parameterExpression] = lambda;
|
||||
}
|
||||
base.VisitLambda(lambda);
|
||||
}
|
||||
|
||||
// Token: 0x06000179 RID: 377 RVA: 0x00009438 File Offset: 0x00007638
|
||||
protected override void VisitParameter(ParameterExpression parameter)
|
||||
{
|
||||
if (this.lambda.Parameters.Contains(parameter))
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.Hoist(parameter);
|
||||
}
|
||||
|
||||
// Token: 0x0600017A RID: 378 RVA: 0x00009458 File Offset: 0x00007658
|
||||
private void Hoist(ParameterExpression parameter)
|
||||
{
|
||||
LambdaExpression lambdaExpression;
|
||||
if (!this.parameter_to_lambda.TryGetValue(parameter, out lambdaExpression))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this.hoisted_map == null)
|
||||
{
|
||||
this.hoisted_map = new Dictionary<LambdaExpression, List<ParameterExpression>>();
|
||||
}
|
||||
List<ParameterExpression> list;
|
||||
if (!this.hoisted_map.TryGetValue(lambdaExpression, out list))
|
||||
{
|
||||
list = new List<ParameterExpression>();
|
||||
this.hoisted_map[lambdaExpression] = list;
|
||||
}
|
||||
list.Add(parameter);
|
||||
}
|
||||
|
||||
// Token: 0x0400006A RID: 106
|
||||
private Dictionary<ParameterExpression, LambdaExpression> parameter_to_lambda = new Dictionary<ParameterExpression, LambdaExpression>();
|
||||
|
||||
// Token: 0x0400006B RID: 107
|
||||
private Dictionary<LambdaExpression, List<ParameterExpression>> hoisted_map;
|
||||
|
||||
// Token: 0x0400006C RID: 108
|
||||
private LambdaExpression lambda;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents an expression that has a conditional operator.</summary>
|
||||
// Token: 0x02000016 RID: 22
|
||||
public sealed class ConditionalExpression : Expression
|
||||
{
|
||||
// Token: 0x06000155 RID: 341 RVA: 0x00008B98 File Offset: 0x00006D98
|
||||
internal ConditionalExpression(Expression test, Expression if_true, Expression if_false)
|
||||
: base(ExpressionType.Conditional, if_true.Type)
|
||||
{
|
||||
this.test = test;
|
||||
this.if_true = if_true;
|
||||
this.if_false = if_false;
|
||||
}
|
||||
|
||||
/// <summary>Gets the test of the conditional operation.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the test of the conditional operation.</returns>
|
||||
// Token: 0x17000017 RID: 23
|
||||
// (get) Token: 0x06000156 RID: 342 RVA: 0x00008BC8 File Offset: 0x00006DC8
|
||||
public Expression Test
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.test;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the expression to execute if the test evaluates to true.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the expression to execute if the test is true.</returns>
|
||||
// Token: 0x17000018 RID: 24
|
||||
// (get) Token: 0x06000157 RID: 343 RVA: 0x00008BD0 File Offset: 0x00006DD0
|
||||
public Expression IfTrue
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.if_true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the expression to execute if the test evaluates to false.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the expression to execute if the test is false.</returns>
|
||||
// Token: 0x17000019 RID: 25
|
||||
// (get) Token: 0x06000158 RID: 344 RVA: 0x00008BD8 File Offset: 0x00006DD8
|
||||
public Expression IfFalse
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.if_false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000159 RID: 345 RVA: 0x00008BE0 File Offset: 0x00006DE0
|
||||
internal override void Emit(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
Label label = ig.DefineLabel();
|
||||
Label label2 = ig.DefineLabel();
|
||||
this.test.Emit(ec);
|
||||
ig.Emit(OpCodes.Brfalse, label);
|
||||
this.if_true.Emit(ec);
|
||||
ig.Emit(OpCodes.Br, label2);
|
||||
ig.MarkLabel(label);
|
||||
this.if_false.Emit(ec);
|
||||
ig.MarkLabel(label2);
|
||||
}
|
||||
|
||||
// Token: 0x0400005E RID: 94
|
||||
private Expression test;
|
||||
|
||||
// Token: 0x0400005F RID: 95
|
||||
private Expression if_true;
|
||||
|
||||
// Token: 0x04000060 RID: 96
|
||||
private Expression if_false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents an expression that has a constant value.</summary>
|
||||
// Token: 0x02000017 RID: 23
|
||||
public sealed class ConstantExpression : Expression
|
||||
{
|
||||
// Token: 0x0600015A RID: 346 RVA: 0x00008C4C File Offset: 0x00006E4C
|
||||
internal ConstantExpression(object value, Type type)
|
||||
: base(ExpressionType.Constant, type)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/// <summary>Gets the value of the constant expression.</summary>
|
||||
/// <returns>An <see cref="T:System.Object" /> equal to the value of the represented expression.</returns>
|
||||
// Token: 0x1700001A RID: 26
|
||||
// (get) Token: 0x0600015B RID: 347 RVA: 0x00008C60 File Offset: 0x00006E60
|
||||
public object Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600015C RID: 348 RVA: 0x00008C68 File Offset: 0x00006E68
|
||||
internal override void Emit(EmitContext ec)
|
||||
{
|
||||
if (base.Type.IsNullable())
|
||||
{
|
||||
this.EmitNullableConstant(ec, base.Type, this.value);
|
||||
return;
|
||||
}
|
||||
this.EmitConstant(ec, base.Type, this.value);
|
||||
}
|
||||
|
||||
// Token: 0x0600015D RID: 349 RVA: 0x00008CAC File Offset: 0x00006EAC
|
||||
private void EmitNullableConstant(EmitContext ec, Type type, object value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
LocalBuilder localBuilder = ig.DeclareLocal(type);
|
||||
ig.Emit(OpCodes.Ldloca, localBuilder);
|
||||
ig.Emit(OpCodes.Initobj, type);
|
||||
ig.Emit(OpCodes.Ldloc, localBuilder);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EmitConstant(ec, type.GetFirstGenericArgument(), value);
|
||||
ec.EmitNullableNew(type);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600015E RID: 350 RVA: 0x00008D0C File Offset: 0x00006F0C
|
||||
private void EmitConstant(EmitContext ec, Type type, object value)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
switch (Type.GetTypeCode(type))
|
||||
{
|
||||
case TypeCode.Object:
|
||||
this.EmitIfNotNull(ec, delegate(EmitContext c)
|
||||
{
|
||||
c.EmitReadGlobal(value);
|
||||
});
|
||||
return;
|
||||
case TypeCode.DBNull:
|
||||
ig.Emit(OpCodes.Ldsfld, typeof(DBNull).GetField("Value", BindingFlags.Static | BindingFlags.Public));
|
||||
return;
|
||||
case TypeCode.Boolean:
|
||||
if ((bool)this.Value)
|
||||
{
|
||||
ig.Emit(OpCodes.Ldc_I4_1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Ldc_I4_0);
|
||||
}
|
||||
return;
|
||||
case TypeCode.Char:
|
||||
ig.Emit(OpCodes.Ldc_I4, (int)((char)value));
|
||||
return;
|
||||
case TypeCode.SByte:
|
||||
ig.Emit(OpCodes.Ldc_I4, (int)((sbyte)value));
|
||||
return;
|
||||
case TypeCode.Byte:
|
||||
ig.Emit(OpCodes.Ldc_I4, (int)((byte)value));
|
||||
return;
|
||||
case TypeCode.Int16:
|
||||
ig.Emit(OpCodes.Ldc_I4, (int)((short)value));
|
||||
return;
|
||||
case TypeCode.UInt16:
|
||||
ig.Emit(OpCodes.Ldc_I4, (int)((ushort)value));
|
||||
return;
|
||||
case TypeCode.Int32:
|
||||
ig.Emit(OpCodes.Ldc_I4, (int)value);
|
||||
return;
|
||||
case TypeCode.UInt32:
|
||||
ig.Emit(OpCodes.Ldc_I4, (int)((uint)this.Value));
|
||||
return;
|
||||
case TypeCode.Int64:
|
||||
ig.Emit(OpCodes.Ldc_I8, (long)value);
|
||||
return;
|
||||
case TypeCode.UInt64:
|
||||
ig.Emit(OpCodes.Ldc_I8, (long)((ulong)value));
|
||||
return;
|
||||
case TypeCode.Single:
|
||||
ig.Emit(OpCodes.Ldc_R4, (float)value);
|
||||
return;
|
||||
case TypeCode.Double:
|
||||
ig.Emit(OpCodes.Ldc_R8, (double)value);
|
||||
return;
|
||||
case TypeCode.Decimal:
|
||||
{
|
||||
decimal num = (decimal)value;
|
||||
int[] bits = decimal.GetBits(num);
|
||||
int num2 = (bits[3] >> 16) & 255;
|
||||
Type typeFromHandle = typeof(int);
|
||||
if (num2 == 0 && num <= 2147483647m && num >= -2147483648m)
|
||||
{
|
||||
ig.Emit(OpCodes.Ldc_I4, (int)num);
|
||||
ig.Emit(OpCodes.Newobj, typeof(decimal).GetConstructor(new Type[] { typeFromHandle }));
|
||||
return;
|
||||
}
|
||||
ig.Emit(OpCodes.Ldc_I4, bits[0]);
|
||||
ig.Emit(OpCodes.Ldc_I4, bits[1]);
|
||||
ig.Emit(OpCodes.Ldc_I4, bits[2]);
|
||||
ig.Emit(OpCodes.Ldc_I4, bits[3] >> 31);
|
||||
ig.Emit(OpCodes.Ldc_I4, num2);
|
||||
ig.Emit(OpCodes.Newobj, typeof(decimal).GetConstructor(new Type[]
|
||||
{
|
||||
typeFromHandle,
|
||||
typeFromHandle,
|
||||
typeFromHandle,
|
||||
typeof(bool),
|
||||
typeof(byte)
|
||||
}));
|
||||
return;
|
||||
}
|
||||
case TypeCode.DateTime:
|
||||
{
|
||||
DateTime dateTime = (DateTime)value;
|
||||
LocalBuilder localBuilder = ig.DeclareLocal(typeof(DateTime));
|
||||
ig.Emit(OpCodes.Ldloca, localBuilder);
|
||||
ig.Emit(OpCodes.Ldc_I8, dateTime.Ticks);
|
||||
ig.Emit(OpCodes.Ldc_I4, (int)dateTime.Kind);
|
||||
ig.Emit(OpCodes.Call, typeof(DateTime).GetConstructor(new Type[]
|
||||
{
|
||||
typeof(long),
|
||||
typeof(DateTimeKind)
|
||||
}));
|
||||
ig.Emit(OpCodes.Ldloc, localBuilder);
|
||||
return;
|
||||
}
|
||||
case TypeCode.String:
|
||||
this.EmitIfNotNull(ec, delegate(EmitContext c)
|
||||
{
|
||||
c.ig.Emit(OpCodes.Ldstr, (string)value);
|
||||
});
|
||||
return;
|
||||
}
|
||||
throw new NotImplementedException(string.Format("No support for constants of type {0} yet", base.Type));
|
||||
}
|
||||
|
||||
// Token: 0x0600015F RID: 351 RVA: 0x000090E8 File Offset: 0x000072E8
|
||||
private void EmitIfNotNull(EmitContext ec, Action<EmitContext> emit)
|
||||
{
|
||||
if (this.value == null)
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Ldnull);
|
||||
return;
|
||||
}
|
||||
emit(ec);
|
||||
}
|
||||
|
||||
// Token: 0x04000061 RID: 97
|
||||
private object value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents an initializer for a single element of an <see cref="T:System.Collections.IEnumerable" /> collection.</summary>
|
||||
// Token: 0x02000018 RID: 24
|
||||
public sealed class ElementInit
|
||||
{
|
||||
// Token: 0x06000160 RID: 352 RVA: 0x00009110 File Offset: 0x00007310
|
||||
internal ElementInit(MethodInfo add_method, ReadOnlyCollection<Expression> arguments)
|
||||
{
|
||||
this.add_method = add_method;
|
||||
this.arguments = arguments;
|
||||
}
|
||||
|
||||
/// <summary>Gets the instance method that is used to add an element to an <see cref="T:System.Collections.IEnumerable" /> collection.</summary>
|
||||
/// <returns>A <see cref="T:System.Reflection.MethodInfo" /> that represents an instance method that adds an element to a collection.</returns>
|
||||
// Token: 0x1700001B RID: 27
|
||||
// (get) Token: 0x06000161 RID: 353 RVA: 0x00009128 File Offset: 0x00007328
|
||||
public MethodInfo AddMethod
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.add_method;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the collection of arguments that are passed to a method that adds an element to an <see cref="T:System.Collections.IEnumerable" /> collection.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.Expression" /> objects that represent the arguments for a method that adds an element to a collection.</returns>
|
||||
// Token: 0x1700001C RID: 28
|
||||
// (get) Token: 0x06000162 RID: 354 RVA: 0x00009130 File Offset: 0x00007330
|
||||
public ReadOnlyCollection<Expression> Arguments
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.arguments;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Returns a textual representation of an <see cref="T:System.Linq.Expressions.ElementInit" /> object.</summary>
|
||||
/// <returns>A textual representation of the <see cref="T:System.Linq.Expressions.ElementInit" /> object.</returns>
|
||||
// Token: 0x06000163 RID: 355 RVA: 0x00009138 File Offset: 0x00007338
|
||||
public override string ToString()
|
||||
{
|
||||
return ExpressionPrinter.ToString(this);
|
||||
}
|
||||
|
||||
// Token: 0x06000164 RID: 356 RVA: 0x00009140 File Offset: 0x00007340
|
||||
private void EmitPopIfNeeded(EmitContext ec)
|
||||
{
|
||||
if (this.add_method.ReturnType == typeof(void))
|
||||
{
|
||||
return;
|
||||
}
|
||||
ec.ig.Emit(OpCodes.Pop);
|
||||
}
|
||||
|
||||
// Token: 0x06000165 RID: 357 RVA: 0x00009170 File Offset: 0x00007370
|
||||
internal void Emit(EmitContext ec, LocalBuilder local)
|
||||
{
|
||||
ec.EmitCall(local, this.arguments, this.add_method);
|
||||
this.EmitPopIfNeeded(ec);
|
||||
}
|
||||
|
||||
// Token: 0x04000062 RID: 98
|
||||
private MethodInfo add_method;
|
||||
|
||||
// Token: 0x04000063 RID: 99
|
||||
private ReadOnlyCollection<Expression> arguments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,456 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
// Token: 0x0200001C RID: 28
|
||||
internal class EmitContext
|
||||
{
|
||||
// Token: 0x0600017B RID: 379 RVA: 0x000094BC File Offset: 0x000076BC
|
||||
public EmitContext(CompilationContext context, EmitContext parent, LambdaExpression lambda)
|
||||
{
|
||||
this.context = context;
|
||||
this.parent = parent;
|
||||
this.lambda = lambda;
|
||||
this.hoisted = context.GetHoistedLocals(lambda);
|
||||
this.method = new DynamicMethod("lambda_method", lambda.GetReturnType(), EmitContext.CreateParameterTypes(lambda.Parameters), typeof(ExecutionScope), true);
|
||||
this.ig = this.method.GetILGenerator();
|
||||
}
|
||||
|
||||
// Token: 0x1700001D RID: 29
|
||||
// (get) Token: 0x0600017C RID: 380 RVA: 0x00009530 File Offset: 0x00007730
|
||||
public bool HasHoistedLocals
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.hoisted != null && this.hoisted.Count > 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700001E RID: 30
|
||||
// (get) Token: 0x0600017D RID: 381 RVA: 0x00009550 File Offset: 0x00007750
|
||||
public LambdaExpression Lambda
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.lambda;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600017E RID: 382 RVA: 0x00009558 File Offset: 0x00007758
|
||||
public void Emit()
|
||||
{
|
||||
if (this.HasHoistedLocals)
|
||||
{
|
||||
this.EmitStoreHoistedLocals();
|
||||
}
|
||||
this.lambda.EmitBody(this);
|
||||
}
|
||||
|
||||
// Token: 0x0600017F RID: 383 RVA: 0x00009578 File Offset: 0x00007778
|
||||
private static Type[] CreateParameterTypes(IList<ParameterExpression> parameters)
|
||||
{
|
||||
Type[] array = new Type[parameters.Count + 1];
|
||||
array[0] = typeof(ExecutionScope);
|
||||
for (int i = 0; i < parameters.Count; i++)
|
||||
{
|
||||
array[i + 1] = parameters[i].Type;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x06000180 RID: 384 RVA: 0x000095CC File Offset: 0x000077CC
|
||||
public bool IsLocalParameter(ParameterExpression parameter, ref int position)
|
||||
{
|
||||
position = this.lambda.Parameters.IndexOf(parameter);
|
||||
if (position > -1)
|
||||
{
|
||||
position++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x06000181 RID: 385 RVA: 0x00009600 File Offset: 0x00007800
|
||||
public Delegate CreateDelegate(ExecutionScope scope)
|
||||
{
|
||||
return this.method.CreateDelegate(this.lambda.Type, scope);
|
||||
}
|
||||
|
||||
// Token: 0x06000182 RID: 386 RVA: 0x0000961C File Offset: 0x0000781C
|
||||
public void Emit(Expression expression)
|
||||
{
|
||||
expression.Emit(this);
|
||||
}
|
||||
|
||||
// Token: 0x06000183 RID: 387 RVA: 0x00009628 File Offset: 0x00007828
|
||||
public LocalBuilder EmitStored(Expression expression)
|
||||
{
|
||||
LocalBuilder localBuilder = this.ig.DeclareLocal(expression.Type);
|
||||
expression.Emit(this);
|
||||
this.ig.Emit(OpCodes.Stloc, localBuilder);
|
||||
return localBuilder;
|
||||
}
|
||||
|
||||
// Token: 0x06000184 RID: 388 RVA: 0x00009660 File Offset: 0x00007860
|
||||
public void EmitLoadAddress(Expression expression)
|
||||
{
|
||||
this.ig.Emit(OpCodes.Ldloca, this.EmitStored(expression));
|
||||
}
|
||||
|
||||
// Token: 0x06000185 RID: 389 RVA: 0x0000967C File Offset: 0x0000787C
|
||||
public void EmitLoadSubject(Expression expression)
|
||||
{
|
||||
if (expression.Type.IsValueType)
|
||||
{
|
||||
this.EmitLoadAddress(expression);
|
||||
return;
|
||||
}
|
||||
this.Emit(expression);
|
||||
}
|
||||
|
||||
// Token: 0x06000186 RID: 390 RVA: 0x000096A8 File Offset: 0x000078A8
|
||||
public void EmitLoadSubject(LocalBuilder local)
|
||||
{
|
||||
if (local.LocalType.IsValueType)
|
||||
{
|
||||
this.EmitLoadAddress(local);
|
||||
return;
|
||||
}
|
||||
this.EmitLoad(local);
|
||||
}
|
||||
|
||||
// Token: 0x06000187 RID: 391 RVA: 0x000096D4 File Offset: 0x000078D4
|
||||
public void EmitLoadAddress(LocalBuilder local)
|
||||
{
|
||||
this.ig.Emit(OpCodes.Ldloca, local);
|
||||
}
|
||||
|
||||
// Token: 0x06000188 RID: 392 RVA: 0x000096E8 File Offset: 0x000078E8
|
||||
public void EmitLoad(LocalBuilder local)
|
||||
{
|
||||
this.ig.Emit(OpCodes.Ldloc, local);
|
||||
}
|
||||
|
||||
// Token: 0x06000189 RID: 393 RVA: 0x000096FC File Offset: 0x000078FC
|
||||
public void EmitCall(LocalBuilder local, IList<Expression> arguments, MethodInfo method)
|
||||
{
|
||||
this.EmitLoadSubject(local);
|
||||
this.EmitArguments(method, arguments);
|
||||
this.EmitCall(method);
|
||||
}
|
||||
|
||||
// Token: 0x0600018A RID: 394 RVA: 0x00009714 File Offset: 0x00007914
|
||||
public void EmitCall(LocalBuilder local, MethodInfo method)
|
||||
{
|
||||
this.EmitLoadSubject(local);
|
||||
this.EmitCall(method);
|
||||
}
|
||||
|
||||
// Token: 0x0600018B RID: 395 RVA: 0x00009724 File Offset: 0x00007924
|
||||
public void EmitCall(Expression expression, MethodInfo method)
|
||||
{
|
||||
if (!method.IsStatic)
|
||||
{
|
||||
this.EmitLoadSubject(expression);
|
||||
}
|
||||
this.EmitCall(method);
|
||||
}
|
||||
|
||||
// Token: 0x0600018C RID: 396 RVA: 0x00009740 File Offset: 0x00007940
|
||||
public void EmitCall(Expression expression, IList<Expression> arguments, MethodInfo method)
|
||||
{
|
||||
if (!method.IsStatic)
|
||||
{
|
||||
this.EmitLoadSubject(expression);
|
||||
}
|
||||
this.EmitArguments(method, arguments);
|
||||
this.EmitCall(method);
|
||||
}
|
||||
|
||||
// Token: 0x0600018D RID: 397 RVA: 0x00009770 File Offset: 0x00007970
|
||||
private void EmitArguments(MethodInfo method, IList<Expression> arguments)
|
||||
{
|
||||
ParameterInfo[] parameters = method.GetParameters();
|
||||
for (int i = 0; i < parameters.Length; i++)
|
||||
{
|
||||
ParameterInfo parameterInfo = parameters[i];
|
||||
Expression expression = arguments[i];
|
||||
if (parameterInfo.ParameterType.IsByRef)
|
||||
{
|
||||
this.ig.Emit(OpCodes.Ldloca, this.EmitStored(expression));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Emit(arguments[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600018E RID: 398 RVA: 0x000097E0 File Offset: 0x000079E0
|
||||
public void EmitCall(MethodInfo method)
|
||||
{
|
||||
this.ig.Emit((!method.IsVirtual) ? OpCodes.Call : OpCodes.Callvirt, method);
|
||||
}
|
||||
|
||||
// Token: 0x0600018F RID: 399 RVA: 0x00009814 File Offset: 0x00007A14
|
||||
public void EmitNullableHasValue(LocalBuilder local)
|
||||
{
|
||||
this.EmitCall(local, "get_HasValue");
|
||||
}
|
||||
|
||||
// Token: 0x06000190 RID: 400 RVA: 0x00009824 File Offset: 0x00007A24
|
||||
public void EmitNullableInitialize(LocalBuilder local)
|
||||
{
|
||||
this.ig.Emit(OpCodes.Ldloca, local);
|
||||
this.ig.Emit(OpCodes.Initobj, local.LocalType);
|
||||
this.ig.Emit(OpCodes.Ldloc, local);
|
||||
}
|
||||
|
||||
// Token: 0x06000191 RID: 401 RVA: 0x0000986C File Offset: 0x00007A6C
|
||||
public void EmitNullableGetValue(LocalBuilder local)
|
||||
{
|
||||
this.EmitCall(local, "get_Value");
|
||||
}
|
||||
|
||||
// Token: 0x06000192 RID: 402 RVA: 0x0000987C File Offset: 0x00007A7C
|
||||
public void EmitNullableGetValueOrDefault(LocalBuilder local)
|
||||
{
|
||||
this.EmitCall(local, "GetValueOrDefault");
|
||||
}
|
||||
|
||||
// Token: 0x06000193 RID: 403 RVA: 0x0000988C File Offset: 0x00007A8C
|
||||
private void EmitCall(LocalBuilder local, string method_name)
|
||||
{
|
||||
this.EmitCall(local, local.LocalType.GetMethod(method_name, Type.EmptyTypes));
|
||||
}
|
||||
|
||||
// Token: 0x06000194 RID: 404 RVA: 0x000098A8 File Offset: 0x00007AA8
|
||||
public void EmitNullableNew(Type of)
|
||||
{
|
||||
this.ig.Emit(OpCodes.Newobj, of.GetConstructor(new Type[] { of.GetFirstGenericArgument() }));
|
||||
}
|
||||
|
||||
// Token: 0x06000195 RID: 405 RVA: 0x000098D0 File Offset: 0x00007AD0
|
||||
public void EmitCollection<T>(IEnumerable<T> collection) where T : Expression
|
||||
{
|
||||
foreach (T t in collection)
|
||||
{
|
||||
t.Emit(this);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000196 RID: 406 RVA: 0x00009938 File Offset: 0x00007B38
|
||||
public void EmitCollection(IEnumerable<ElementInit> initializers, LocalBuilder local)
|
||||
{
|
||||
foreach (ElementInit elementInit in initializers)
|
||||
{
|
||||
elementInit.Emit(this, local);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000197 RID: 407 RVA: 0x00009998 File Offset: 0x00007B98
|
||||
public void EmitCollection(IEnumerable<MemberBinding> bindings, LocalBuilder local)
|
||||
{
|
||||
foreach (MemberBinding memberBinding in bindings)
|
||||
{
|
||||
memberBinding.Emit(this, local);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000198 RID: 408 RVA: 0x000099F8 File Offset: 0x00007BF8
|
||||
public void EmitIsInst(Expression expression, Type candidate)
|
||||
{
|
||||
expression.Emit(this);
|
||||
Type type = expression.Type;
|
||||
if (type.IsValueType)
|
||||
{
|
||||
this.ig.Emit(OpCodes.Box, type);
|
||||
}
|
||||
this.ig.Emit(OpCodes.Isinst, candidate);
|
||||
}
|
||||
|
||||
// Token: 0x06000199 RID: 409 RVA: 0x00009A40 File Offset: 0x00007C40
|
||||
public void EmitScope()
|
||||
{
|
||||
this.ig.Emit(OpCodes.Ldarg_0);
|
||||
}
|
||||
|
||||
// Token: 0x0600019A RID: 410 RVA: 0x00009A54 File Offset: 0x00007C54
|
||||
public void EmitReadGlobal(object global)
|
||||
{
|
||||
this.EmitReadGlobal(global, global.GetType());
|
||||
}
|
||||
|
||||
// Token: 0x0600019B RID: 411 RVA: 0x00009A64 File Offset: 0x00007C64
|
||||
public void EmitLoadGlobals()
|
||||
{
|
||||
this.EmitScope();
|
||||
this.ig.Emit(OpCodes.Ldfld, typeof(ExecutionScope).GetField("Globals"));
|
||||
}
|
||||
|
||||
// Token: 0x0600019C RID: 412 RVA: 0x00009A9C File Offset: 0x00007C9C
|
||||
public void EmitReadGlobal(object global, Type type)
|
||||
{
|
||||
this.EmitLoadGlobals();
|
||||
this.ig.Emit(OpCodes.Ldc_I4, this.AddGlobal(global, type));
|
||||
this.ig.Emit(OpCodes.Ldelem, typeof(object));
|
||||
this.EmitLoadStrongBoxValue(type);
|
||||
}
|
||||
|
||||
// Token: 0x0600019D RID: 413 RVA: 0x00009AE8 File Offset: 0x00007CE8
|
||||
public void EmitLoadStrongBoxValue(Type type)
|
||||
{
|
||||
Type type2 = type.MakeStrongBoxType();
|
||||
this.ig.Emit(OpCodes.Isinst, type2);
|
||||
this.ig.Emit(OpCodes.Ldfld, type2.GetField("Value"));
|
||||
}
|
||||
|
||||
// Token: 0x0600019E RID: 414 RVA: 0x00009B28 File Offset: 0x00007D28
|
||||
private int AddGlobal(object value, Type type)
|
||||
{
|
||||
return this.context.AddGlobal(EmitContext.CreateStrongBox(value, type));
|
||||
}
|
||||
|
||||
// Token: 0x0600019F RID: 415 RVA: 0x00009B3C File Offset: 0x00007D3C
|
||||
public void EmitCreateDelegate(LambdaExpression lambda)
|
||||
{
|
||||
this.EmitScope();
|
||||
this.ig.Emit(OpCodes.Ldc_I4, this.AddChildContext(lambda));
|
||||
if (this.hoisted_store != null)
|
||||
{
|
||||
this.ig.Emit(OpCodes.Ldloc, this.hoisted_store);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ig.Emit(OpCodes.Ldnull);
|
||||
}
|
||||
this.ig.Emit(OpCodes.Callvirt, typeof(ExecutionScope).GetMethod("CreateDelegate"));
|
||||
this.ig.Emit(OpCodes.Castclass, lambda.Type);
|
||||
}
|
||||
|
||||
// Token: 0x060001A0 RID: 416 RVA: 0x00009BD8 File Offset: 0x00007DD8
|
||||
private void EmitStoreHoistedLocals()
|
||||
{
|
||||
this.EmitHoistedLocalsStore();
|
||||
for (int i = 0; i < this.hoisted.Count; i++)
|
||||
{
|
||||
this.EmitStoreHoistedLocal(i, this.hoisted[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001A1 RID: 417 RVA: 0x00009C1C File Offset: 0x00007E1C
|
||||
private void EmitStoreHoistedLocal(int position, ParameterExpression parameter)
|
||||
{
|
||||
this.ig.Emit(OpCodes.Ldloc, this.hoisted_store);
|
||||
this.ig.Emit(OpCodes.Ldc_I4, position);
|
||||
parameter.Emit(this);
|
||||
this.EmitCreateStrongBox(parameter.Type);
|
||||
this.ig.Emit(OpCodes.Stelem, typeof(object));
|
||||
}
|
||||
|
||||
// Token: 0x060001A2 RID: 418 RVA: 0x00009C80 File Offset: 0x00007E80
|
||||
public void EmitLoadHoistedLocalsStore()
|
||||
{
|
||||
this.ig.Emit(OpCodes.Ldloc, this.hoisted_store);
|
||||
}
|
||||
|
||||
// Token: 0x060001A3 RID: 419 RVA: 0x00009C98 File Offset: 0x00007E98
|
||||
private void EmitCreateStrongBox(Type type)
|
||||
{
|
||||
this.ig.Emit(OpCodes.Newobj, type.MakeStrongBoxType().GetConstructor(new Type[] { type }));
|
||||
}
|
||||
|
||||
// Token: 0x060001A4 RID: 420 RVA: 0x00009CC0 File Offset: 0x00007EC0
|
||||
private void EmitHoistedLocalsStore()
|
||||
{
|
||||
this.EmitScope();
|
||||
this.hoisted_store = this.ig.DeclareLocal(typeof(object[]));
|
||||
this.ig.Emit(OpCodes.Callvirt, typeof(ExecutionScope).GetMethod("CreateHoistedLocals"));
|
||||
this.ig.Emit(OpCodes.Stloc, this.hoisted_store);
|
||||
}
|
||||
|
||||
// Token: 0x060001A5 RID: 421 RVA: 0x00009D28 File Offset: 0x00007F28
|
||||
public void EmitLoadLocals()
|
||||
{
|
||||
this.ig.Emit(OpCodes.Ldfld, typeof(ExecutionScope).GetField("Locals"));
|
||||
}
|
||||
|
||||
// Token: 0x060001A6 RID: 422 RVA: 0x00009D5C File Offset: 0x00007F5C
|
||||
public void EmitParentScope()
|
||||
{
|
||||
this.ig.Emit(OpCodes.Ldfld, typeof(ExecutionScope).GetField("Parent"));
|
||||
}
|
||||
|
||||
// Token: 0x060001A7 RID: 423 RVA: 0x00009D90 File Offset: 0x00007F90
|
||||
public void EmitIsolateExpression()
|
||||
{
|
||||
this.ig.Emit(OpCodes.Callvirt, typeof(ExecutionScope).GetMethod("IsolateExpression"));
|
||||
}
|
||||
|
||||
// Token: 0x060001A8 RID: 424 RVA: 0x00009DC4 File Offset: 0x00007FC4
|
||||
public int IndexOfHoistedLocal(ParameterExpression parameter)
|
||||
{
|
||||
if (!this.HasHoistedLocals)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return this.hoisted.IndexOf(parameter);
|
||||
}
|
||||
|
||||
// Token: 0x060001A9 RID: 425 RVA: 0x00009DE0 File Offset: 0x00007FE0
|
||||
public bool IsHoistedLocal(ParameterExpression parameter, ref int level, ref int position)
|
||||
{
|
||||
if (this.parent == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (this.parent.hoisted != null)
|
||||
{
|
||||
position = this.parent.hoisted.IndexOf(parameter);
|
||||
if (position > -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
level++;
|
||||
return this.parent.IsHoistedLocal(parameter, ref level, ref position);
|
||||
}
|
||||
|
||||
// Token: 0x060001AA RID: 426 RVA: 0x00009E3C File Offset: 0x0000803C
|
||||
private int AddChildContext(LambdaExpression lambda)
|
||||
{
|
||||
return this.context.AddCompilationUnit(this, lambda);
|
||||
}
|
||||
|
||||
// Token: 0x060001AB RID: 427 RVA: 0x00009E4C File Offset: 0x0000804C
|
||||
private static object CreateStrongBox(object value, Type type)
|
||||
{
|
||||
return Activator.CreateInstance(type.MakeStrongBoxType(), new object[] { value });
|
||||
}
|
||||
|
||||
// Token: 0x0400006D RID: 109
|
||||
private CompilationContext context;
|
||||
|
||||
// Token: 0x0400006E RID: 110
|
||||
private EmitContext parent;
|
||||
|
||||
// Token: 0x0400006F RID: 111
|
||||
private LambdaExpression lambda;
|
||||
|
||||
// Token: 0x04000070 RID: 112
|
||||
private DynamicMethod method;
|
||||
|
||||
// Token: 0x04000071 RID: 113
|
||||
private LocalBuilder hoisted_store;
|
||||
|
||||
// Token: 0x04000072 RID: 114
|
||||
private List<ParameterExpression> hoisted;
|
||||
|
||||
// Token: 0x04000073 RID: 115
|
||||
public readonly ILGenerator ig;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3621 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Provides the base class from which the classes that represent expression tree nodes are derived. It also contains static (Shared in Visual Basic) factory methods to create the various node types. This is an abstract class.</summary>
|
||||
// Token: 0x02000005 RID: 5
|
||||
public abstract class Expression
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Linq.Expressions.Expression" /> class.</summary>
|
||||
/// <param name="nodeType">The <see cref="T:System.Linq.Expressions.ExpressionType" /> to set as the node type.</param>
|
||||
/// <param name="type">The <see cref="T:System.Type" /> to set as the type of the expression that this <see cref="T:System.Linq.Expressions.Expression" /> represents.</param>
|
||||
// Token: 0x0600000C RID: 12 RVA: 0x000021FC File Offset: 0x000003FC
|
||||
protected Expression(ExpressionType node_type, Type type)
|
||||
{
|
||||
this.node_type = node_type;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/// <summary>Gets the node type of this <see cref="T:System.Linq.Expressions.Expression" />.</summary>
|
||||
/// <returns>One of the <see cref="T:System.Linq.Expressions.ExpressionType" /> values.</returns>
|
||||
// Token: 0x17000003 RID: 3
|
||||
// (get) Token: 0x0600000D RID: 13 RVA: 0x00002214 File Offset: 0x00000414
|
||||
public ExpressionType NodeType
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.node_type;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the static type of the expression that this <see cref="T:System.Linq.Expressions.Expression" /> represents.</summary>
|
||||
/// <returns>The <see cref="T:System.Type" /> that represents the static type of the expression.</returns>
|
||||
// Token: 0x17000004 RID: 4
|
||||
// (get) Token: 0x0600000E RID: 14 RVA: 0x0000221C File Offset: 0x0000041C
|
||||
public Type Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.type;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Returns a textual representation of the <see cref="T:System.Linq.Expressions.Expression" />.</summary>
|
||||
/// <returns>A textual representation of the <see cref="T:System.Linq.Expressions.Expression" />.</returns>
|
||||
// Token: 0x0600000F RID: 15 RVA: 0x00002224 File Offset: 0x00000424
|
||||
public override string ToString()
|
||||
{
|
||||
return ExpressionPrinter.ToString(this);
|
||||
}
|
||||
|
||||
// Token: 0x06000010 RID: 16 RVA: 0x0000222C File Offset: 0x0000042C
|
||||
private static MethodInfo GetUnaryOperator(string oper_name, Type declaring, Type param)
|
||||
{
|
||||
return Expression.GetUnaryOperator(oper_name, declaring, param, null);
|
||||
}
|
||||
|
||||
// Token: 0x06000011 RID: 17 RVA: 0x00002238 File Offset: 0x00000438
|
||||
private static MethodInfo GetUnaryOperator(string oper_name, Type declaring, Type param, Type ret)
|
||||
{
|
||||
MethodInfo[] methods = declaring.GetNotNullableType().GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
|
||||
foreach (MethodInfo methodInfo in methods)
|
||||
{
|
||||
if (!(methodInfo.Name != oper_name))
|
||||
{
|
||||
ParameterInfo[] parameters = methodInfo.GetParameters();
|
||||
if (parameters.Length == 1)
|
||||
{
|
||||
if (!methodInfo.IsGenericMethod)
|
||||
{
|
||||
if (Expression.IsAssignableToParameterType(param.GetNotNullableType(), parameters[0]))
|
||||
{
|
||||
if (ret == null || methodInfo.ReturnType == ret.GetNotNullableType())
|
||||
{
|
||||
return methodInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x06000012 RID: 18 RVA: 0x000022E4 File Offset: 0x000004E4
|
||||
internal static MethodInfo GetTrueOperator(Type self)
|
||||
{
|
||||
return Expression.GetBooleanOperator("op_True", self);
|
||||
}
|
||||
|
||||
// Token: 0x06000013 RID: 19 RVA: 0x000022F4 File Offset: 0x000004F4
|
||||
internal static MethodInfo GetFalseOperator(Type self)
|
||||
{
|
||||
return Expression.GetBooleanOperator("op_False", self);
|
||||
}
|
||||
|
||||
// Token: 0x06000014 RID: 20 RVA: 0x00002304 File Offset: 0x00000504
|
||||
private static MethodInfo GetBooleanOperator(string op, Type self)
|
||||
{
|
||||
return Expression.GetUnaryOperator(op, self, self, typeof(bool));
|
||||
}
|
||||
|
||||
// Token: 0x06000015 RID: 21 RVA: 0x00002318 File Offset: 0x00000518
|
||||
private static bool IsAssignableToParameterType(Type type, ParameterInfo param)
|
||||
{
|
||||
Type type2 = param.ParameterType;
|
||||
if (type2.IsByRef)
|
||||
{
|
||||
type2 = type2.GetElementType();
|
||||
}
|
||||
return type.GetNotNullableType().IsAssignableTo(type2);
|
||||
}
|
||||
|
||||
// Token: 0x06000016 RID: 22 RVA: 0x0000234C File Offset: 0x0000054C
|
||||
private static MethodInfo CheckUnaryMethod(MethodInfo method, Type param)
|
||||
{
|
||||
if (method.ReturnType == typeof(void))
|
||||
{
|
||||
throw new ArgumentException("Specified method must return a value", "method");
|
||||
}
|
||||
if (!method.IsStatic)
|
||||
{
|
||||
throw new ArgumentException("Method must be static", "method");
|
||||
}
|
||||
ParameterInfo[] parameters = method.GetParameters();
|
||||
if (parameters.Length != 1)
|
||||
{
|
||||
throw new ArgumentException("Must have only one parameters", "method");
|
||||
}
|
||||
if (!Expression.IsAssignableToParameterType(param.GetNotNullableType(), parameters[0]))
|
||||
{
|
||||
throw new InvalidOperationException("left-side argument type does not match expression type");
|
||||
}
|
||||
return method;
|
||||
}
|
||||
|
||||
// Token: 0x06000017 RID: 23 RVA: 0x000023D8 File Offset: 0x000005D8
|
||||
private static MethodInfo UnaryCoreCheck(string oper_name, Expression expression, MethodInfo method, Func<Type, bool> validator)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
if (method != null)
|
||||
{
|
||||
return Expression.CheckUnaryMethod(method, expression.Type);
|
||||
}
|
||||
Type notNullableType = expression.Type.GetNotNullableType();
|
||||
if (validator(notNullableType))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (oper_name != null)
|
||||
{
|
||||
method = Expression.GetUnaryOperator(oper_name, notNullableType, expression.Type);
|
||||
if (method != null)
|
||||
{
|
||||
return method;
|
||||
}
|
||||
}
|
||||
throw new InvalidOperationException(string.Format("Operation {0} not defined for {1}", (oper_name == null) ? "is" : oper_name.Substring(3), expression.Type));
|
||||
}
|
||||
|
||||
// Token: 0x06000018 RID: 24 RVA: 0x0000246C File Offset: 0x0000066C
|
||||
private static MethodInfo GetBinaryOperator(string oper_name, Type on_type, Expression left, Expression right)
|
||||
{
|
||||
MethodInfo[] methods = on_type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
|
||||
foreach (MethodInfo methodInfo in methods)
|
||||
{
|
||||
if (!(methodInfo.Name != oper_name))
|
||||
{
|
||||
ParameterInfo[] parameters = methodInfo.GetParameters();
|
||||
if (parameters.Length == 2)
|
||||
{
|
||||
if (!methodInfo.IsGenericMethod)
|
||||
{
|
||||
if (Expression.IsAssignableToParameterType(left.Type, parameters[0]))
|
||||
{
|
||||
if (Expression.IsAssignableToParameterType(right.Type, parameters[1]))
|
||||
{
|
||||
return methodInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x06000019 RID: 25 RVA: 0x00002510 File Offset: 0x00000710
|
||||
private static MethodInfo BinaryCoreCheck(string oper_name, Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
if (left == null)
|
||||
{
|
||||
throw new ArgumentNullException("left");
|
||||
}
|
||||
if (right == null)
|
||||
{
|
||||
throw new ArgumentNullException("right");
|
||||
}
|
||||
if (method != null)
|
||||
{
|
||||
if (method.ReturnType == typeof(void))
|
||||
{
|
||||
throw new ArgumentException("Specified method must return a value", "method");
|
||||
}
|
||||
if (!method.IsStatic)
|
||||
{
|
||||
throw new ArgumentException("Method must be static", "method");
|
||||
}
|
||||
ParameterInfo[] parameters = method.GetParameters();
|
||||
if (parameters.Length != 2)
|
||||
{
|
||||
throw new ArgumentException("Must have only two parameters", "method");
|
||||
}
|
||||
if (!Expression.IsAssignableToParameterType(left.Type, parameters[0]))
|
||||
{
|
||||
throw new InvalidOperationException("left-side argument type does not match left expression type");
|
||||
}
|
||||
if (!Expression.IsAssignableToParameterType(right.Type, parameters[1]))
|
||||
{
|
||||
throw new InvalidOperationException("right-side argument type does not match right expression type");
|
||||
}
|
||||
return method;
|
||||
}
|
||||
else
|
||||
{
|
||||
Type type = left.Type;
|
||||
Type type2 = right.Type;
|
||||
Type notNullableType = type.GetNotNullableType();
|
||||
Type notNullableType2 = type2.GetNotNullableType();
|
||||
if ((oper_name == "op_BitwiseOr" || oper_name == "op_BitwiseAnd") && notNullableType == typeof(bool) && notNullableType == notNullableType2 && type == type2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (Expression.IsNumber(notNullableType))
|
||||
{
|
||||
if (notNullableType == notNullableType2 && type == type2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (oper_name != null)
|
||||
{
|
||||
method = Expression.GetBinaryOperator(oper_name, notNullableType2, left, right);
|
||||
if (method != null)
|
||||
{
|
||||
return method;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (oper_name != null)
|
||||
{
|
||||
method = Expression.GetBinaryOperator(oper_name, notNullableType, left, right);
|
||||
if (method != null)
|
||||
{
|
||||
return method;
|
||||
}
|
||||
}
|
||||
if (oper_name == "op_Equality" || oper_name == "op_Inequality")
|
||||
{
|
||||
if (!type.IsValueType && !type2.IsValueType)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (type == type2 && notNullableType.IsEnum)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (type == type2 && notNullableType == typeof(bool))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if ((oper_name == "op_LeftShift" || oper_name == "op_RightShift") && Expression.IsInt(notNullableType) && notNullableType2 == typeof(int))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
throw new InvalidOperationException(string.Format("Operation {0} not defined for {1} and {2}", (oper_name == null) ? "is" : oper_name.Substring(3), type, type2));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600001A RID: 26 RVA: 0x0000275C File Offset: 0x0000095C
|
||||
private static MethodInfo BinaryBitwiseCoreCheck(string oper_name, Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
if (left == null)
|
||||
{
|
||||
throw new ArgumentNullException("left");
|
||||
}
|
||||
if (right == null)
|
||||
{
|
||||
throw new ArgumentNullException("right");
|
||||
}
|
||||
if (method == null && left.Type == right.Type && Expression.IsIntOrBool(left.Type))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
method = Expression.BinaryCoreCheck(oper_name, left, right, method);
|
||||
if (method == null && (left.Type == typeof(double) || left.Type == typeof(float)))
|
||||
{
|
||||
throw new InvalidOperationException("Types not supported");
|
||||
}
|
||||
return method;
|
||||
}
|
||||
|
||||
// Token: 0x0600001B RID: 27 RVA: 0x000027FC File Offset: 0x000009FC
|
||||
private static BinaryExpression MakeSimpleBinary(ExpressionType et, Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
bool flag;
|
||||
Type type;
|
||||
if (method == null)
|
||||
{
|
||||
flag = left.Type.IsNullable();
|
||||
type = left.Type;
|
||||
}
|
||||
else
|
||||
{
|
||||
ParameterInfo[] parameters = method.GetParameters();
|
||||
ParameterInfo parameterInfo = parameters[0];
|
||||
ParameterInfo parameterInfo2 = parameters[1];
|
||||
if (Expression.IsAssignableToOperatorParameter(left, parameterInfo) && Expression.IsAssignableToOperatorParameter(right, parameterInfo2))
|
||||
{
|
||||
flag = false;
|
||||
type = method.ReturnType;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!left.Type.IsNullable() || !right.Type.IsNullable() || left.Type.GetNotNullableType() != parameterInfo.ParameterType || right.Type.GetNotNullableType() != parameterInfo2.ParameterType || method.ReturnType.IsNullable())
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
flag = true;
|
||||
type = method.ReturnType.MakeNullableType();
|
||||
}
|
||||
}
|
||||
return new BinaryExpression(et, type, left, right, flag, flag, method, null);
|
||||
}
|
||||
|
||||
// Token: 0x0600001C RID: 28 RVA: 0x000028E4 File Offset: 0x00000AE4
|
||||
private static bool IsAssignableToOperatorParameter(Expression expression, ParameterInfo parameter)
|
||||
{
|
||||
return expression.Type == parameter.ParameterType || (!expression.Type.IsNullable() && !parameter.ParameterType.IsNullable() && Expression.IsAssignableToParameterType(expression.Type, parameter));
|
||||
}
|
||||
|
||||
// Token: 0x0600001D RID: 29 RVA: 0x00002938 File Offset: 0x00000B38
|
||||
private static UnaryExpression MakeSimpleUnary(ExpressionType et, Expression expression, MethodInfo method)
|
||||
{
|
||||
Type type;
|
||||
bool flag;
|
||||
if (method == null)
|
||||
{
|
||||
type = expression.Type;
|
||||
flag = type.IsNullable();
|
||||
}
|
||||
else
|
||||
{
|
||||
ParameterInfo parameterInfo = method.GetParameters()[0];
|
||||
if (Expression.IsAssignableToOperatorParameter(expression, parameterInfo))
|
||||
{
|
||||
flag = false;
|
||||
type = method.ReturnType;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!expression.Type.IsNullable() || expression.Type.GetNotNullableType() != parameterInfo.ParameterType || method.ReturnType.IsNullable())
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
flag = true;
|
||||
type = method.ReturnType.MakeNullableType();
|
||||
}
|
||||
}
|
||||
return new UnaryExpression(et, expression, type, method, flag);
|
||||
}
|
||||
|
||||
// Token: 0x0600001E RID: 30 RVA: 0x000029DC File Offset: 0x00000BDC
|
||||
private static BinaryExpression MakeBoolBinary(ExpressionType et, Expression left, Expression right, bool liftToNull, MethodInfo method)
|
||||
{
|
||||
bool flag;
|
||||
Type type;
|
||||
if (method == null)
|
||||
{
|
||||
if (!left.Type.IsNullable() && !right.Type.IsNullable())
|
||||
{
|
||||
flag = false;
|
||||
liftToNull = false;
|
||||
type = typeof(bool);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!left.Type.IsNullable() || !right.Type.IsNullable())
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
flag = true;
|
||||
type = ((!liftToNull) ? typeof(bool) : typeof(bool?));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ParameterInfo[] parameters = method.GetParameters();
|
||||
ParameterInfo parameterInfo = parameters[0];
|
||||
ParameterInfo parameterInfo2 = parameters[1];
|
||||
if (Expression.IsAssignableToOperatorParameter(left, parameterInfo) && Expression.IsAssignableToOperatorParameter(right, parameterInfo2))
|
||||
{
|
||||
flag = false;
|
||||
liftToNull = false;
|
||||
type = method.ReturnType;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!left.Type.IsNullable() || !right.Type.IsNullable() || left.Type.GetNotNullableType() != parameterInfo.ParameterType || right.Type.GetNotNullableType() != parameterInfo2.ParameterType)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
flag = true;
|
||||
if (method.ReturnType == typeof(bool))
|
||||
{
|
||||
type = ((!liftToNull) ? typeof(bool) : typeof(bool?));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (method.ReturnType.IsNullable())
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
type = method.ReturnType.MakeNullableType();
|
||||
}
|
||||
}
|
||||
}
|
||||
return new BinaryExpression(et, type, left, right, liftToNull, flag, method, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic addition operation that does not have overflow checking.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Add" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The addition operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x0600001F RID: 31 RVA: 0x00002B80 File Offset: 0x00000D80
|
||||
public static BinaryExpression Add(Expression left, Expression right)
|
||||
{
|
||||
return Expression.Add(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic addition operation that does not have overflow checking. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Add" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the addition operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000020 RID: 32 RVA: 0x00002B8C File Offset: 0x00000D8C
|
||||
public static BinaryExpression Add(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_Addition", left, right, method);
|
||||
return Expression.MakeSimpleBinary(ExpressionType.Add, left, right, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic addition operation that has overflow checking.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.AddChecked" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The addition operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000021 RID: 33 RVA: 0x00002BA8 File Offset: 0x00000DA8
|
||||
public static BinaryExpression AddChecked(Expression left, Expression right)
|
||||
{
|
||||
return Expression.AddChecked(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic addition operation that has overflow checking. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.AddChecked" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the addition operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000022 RID: 34 RVA: 0x00002BB4 File Offset: 0x00000DB4
|
||||
public static BinaryExpression AddChecked(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_Addition", left, right, method);
|
||||
if (method == null && (left.Type == typeof(byte) || left.Type == typeof(sbyte)))
|
||||
{
|
||||
throw new InvalidOperationException(string.Format("AddChecked not defined for {0} and {1}", left.Type, right.Type));
|
||||
}
|
||||
return Expression.MakeSimpleBinary(ExpressionType.AddChecked, left, right, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic subtraction operation that does not have overflow checking.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Subtract" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The subtraction operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000023 RID: 35 RVA: 0x00002C28 File Offset: 0x00000E28
|
||||
public static BinaryExpression Subtract(Expression left, Expression right)
|
||||
{
|
||||
return Expression.Subtract(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic subtraction operation that does not have overflow checking. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Subtract" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the subtraction operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000024 RID: 36 RVA: 0x00002C34 File Offset: 0x00000E34
|
||||
public static BinaryExpression Subtract(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_Subtraction", left, right, method);
|
||||
return Expression.MakeSimpleBinary(ExpressionType.Subtract, left, right, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic subtraction operation that has overflow checking.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.SubtractChecked" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The subtraction operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000025 RID: 37 RVA: 0x00002C50 File Offset: 0x00000E50
|
||||
public static BinaryExpression SubtractChecked(Expression left, Expression right)
|
||||
{
|
||||
return Expression.SubtractChecked(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic subtraction operation that has overflow checking. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.SubtractChecked" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the subtraction operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000026 RID: 38 RVA: 0x00002C5C File Offset: 0x00000E5C
|
||||
public static BinaryExpression SubtractChecked(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_Subtraction", left, right, method);
|
||||
if (method == null && (left.Type == typeof(byte) || left.Type == typeof(sbyte)))
|
||||
{
|
||||
throw new InvalidOperationException(string.Format("SubtractChecked not defined for {0} and {1}", left.Type, right.Type));
|
||||
}
|
||||
return Expression.MakeSimpleBinary(ExpressionType.SubtractChecked, left, right, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic remainder operation.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Modulo" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The modulus operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000027 RID: 39 RVA: 0x00002CD0 File Offset: 0x00000ED0
|
||||
public static BinaryExpression Modulo(Expression left, Expression right)
|
||||
{
|
||||
return Expression.Modulo(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic remainder operation. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Modulo" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the modulus operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000028 RID: 40 RVA: 0x00002CDC File Offset: 0x00000EDC
|
||||
public static BinaryExpression Modulo(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_Modulus", left, right, method);
|
||||
return Expression.MakeSimpleBinary(ExpressionType.Modulo, left, right, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic multiplication operation that does not have overflow checking.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Multiply" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The multiplication operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000029 RID: 41 RVA: 0x00002CF8 File Offset: 0x00000EF8
|
||||
public static BinaryExpression Multiply(Expression left, Expression right)
|
||||
{
|
||||
return Expression.Multiply(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic multiplication operation that does not have overflow checking and for which the implementing method is specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Multiply" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the multiplication operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x0600002A RID: 42 RVA: 0x00002D04 File Offset: 0x00000F04
|
||||
public static BinaryExpression Multiply(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_Multiply", left, right, method);
|
||||
return Expression.MakeSimpleBinary(ExpressionType.Multiply, left, right, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic multiplication operation that has overflow checking.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MultiplyChecked" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The multiplication operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x0600002B RID: 43 RVA: 0x00002D20 File Offset: 0x00000F20
|
||||
public static BinaryExpression MultiplyChecked(Expression left, Expression right)
|
||||
{
|
||||
return Expression.MultiplyChecked(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic multiplication operation that has overflow checking. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MultiplyChecked" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the multiplication operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x0600002C RID: 44 RVA: 0x00002D2C File Offset: 0x00000F2C
|
||||
public static BinaryExpression MultiplyChecked(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_Multiply", left, right, method);
|
||||
return Expression.MakeSimpleBinary(ExpressionType.MultiplyChecked, left, right, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic division operation.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Divide" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The division operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x0600002D RID: 45 RVA: 0x00002D48 File Offset: 0x00000F48
|
||||
public static BinaryExpression Divide(Expression left, Expression right)
|
||||
{
|
||||
return Expression.Divide(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an arithmetic division operation. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Divide" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the division operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x0600002E RID: 46 RVA: 0x00002D54 File Offset: 0x00000F54
|
||||
public static BinaryExpression Divide(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_Division", left, right, method);
|
||||
return Expression.MakeSimpleBinary(ExpressionType.Divide, left, right, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents raising a number to a power.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Power" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The exponentiation operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.-or-<paramref name="left" />.Type and/or <paramref name="right" />.Type are not <see cref="T:System.Double" />.</exception>
|
||||
// Token: 0x0600002F RID: 47 RVA: 0x00002D70 File Offset: 0x00000F70
|
||||
public static BinaryExpression Power(Expression left, Expression right)
|
||||
{
|
||||
return Expression.Power(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents raising a number to a power. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Power" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the exponentiation operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.-or-<paramref name="method" /> is null and <paramref name="left" />.Type and/or <paramref name="right" />.Type are not <see cref="T:System.Double" />.</exception>
|
||||
// Token: 0x06000030 RID: 48 RVA: 0x00002D7C File Offset: 0x00000F7C
|
||||
public static BinaryExpression Power(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck(null, left, right, method);
|
||||
if (left.Type.GetNotNullableType() != typeof(double))
|
||||
{
|
||||
throw new InvalidOperationException("Power only supports double arguments");
|
||||
}
|
||||
return Expression.MakeSimpleBinary(ExpressionType.Power, left, right, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise AND operation.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.And" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The bitwise AND operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000031 RID: 49 RVA: 0x00002DC4 File Offset: 0x00000FC4
|
||||
public static BinaryExpression And(Expression left, Expression right)
|
||||
{
|
||||
return Expression.And(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise AND operation. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.And" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the bitwise AND operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000032 RID: 50 RVA: 0x00002DD0 File Offset: 0x00000FD0
|
||||
public static BinaryExpression And(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryBitwiseCoreCheck("op_BitwiseAnd", left, right, method);
|
||||
return Expression.MakeSimpleBinary(ExpressionType.And, left, right, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise OR operation.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Or" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The bitwise OR operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000033 RID: 51 RVA: 0x00002DEC File Offset: 0x00000FEC
|
||||
public static BinaryExpression Or(Expression left, Expression right)
|
||||
{
|
||||
return Expression.Or(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise OR operation. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Or" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the bitwise OR operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000034 RID: 52 RVA: 0x00002DF8 File Offset: 0x00000FF8
|
||||
public static BinaryExpression Or(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryBitwiseCoreCheck("op_BitwiseOr", left, right, method);
|
||||
return Expression.MakeSimpleBinary(ExpressionType.Or, left, right, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise XOR operation.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ExclusiveOr" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The XOR operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000035 RID: 53 RVA: 0x00002E14 File Offset: 0x00001014
|
||||
public static BinaryExpression ExclusiveOr(Expression left, Expression right)
|
||||
{
|
||||
return Expression.ExclusiveOr(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise XOR operation. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ExclusiveOr" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the XOR operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000036 RID: 54 RVA: 0x00002E20 File Offset: 0x00001020
|
||||
public static BinaryExpression ExclusiveOr(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryBitwiseCoreCheck("op_ExclusiveOr", left, right, method);
|
||||
return Expression.MakeSimpleBinary(ExpressionType.ExclusiveOr, left, right, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise left-shift operation.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.LeftShift" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The left-shift operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000037 RID: 55 RVA: 0x00002E3C File Offset: 0x0000103C
|
||||
public static BinaryExpression LeftShift(Expression left, Expression right)
|
||||
{
|
||||
return Expression.LeftShift(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise left-shift operation. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.LeftShift" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the left-shift operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000038 RID: 56 RVA: 0x00002E48 File Offset: 0x00001048
|
||||
public static BinaryExpression LeftShift(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryBitwiseCoreCheck("op_LeftShift", left, right, method);
|
||||
return Expression.MakeSimpleBinary(ExpressionType.LeftShift, left, right, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise right-shift operation.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.RightShift" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The right-shift operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000039 RID: 57 RVA: 0x00002E64 File Offset: 0x00001064
|
||||
public static BinaryExpression RightShift(Expression left, Expression right)
|
||||
{
|
||||
return Expression.RightShift(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a bitwise right-shift operation. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.RightShift" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the right-shift operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x0600003A RID: 58 RVA: 0x00002E70 File Offset: 0x00001070
|
||||
public static BinaryExpression RightShift(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_RightShift", left, right, method);
|
||||
return Expression.MakeSimpleBinary(ExpressionType.RightShift, left, right, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a conditional AND operation that evaluates the second operand only if it has to.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.AndAlso" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The bitwise AND operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.-or-<paramref name="left" />.Type and <paramref name="right" />.Type are not the same Boolean type.</exception>
|
||||
// Token: 0x0600003B RID: 59 RVA: 0x00002E8C File Offset: 0x0000108C
|
||||
public static BinaryExpression AndAlso(Expression left, Expression right)
|
||||
{
|
||||
return Expression.AndAlso(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a conditional AND operation that evaluates the second operand only if it has to. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.AndAlso" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the bitwise AND operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.-or-<paramref name="method" /> is null and <paramref name="left" />.Type and <paramref name="right" />.Type are not the same Boolean type.</exception>
|
||||
// Token: 0x0600003C RID: 60 RVA: 0x00002E98 File Offset: 0x00001098
|
||||
public static BinaryExpression AndAlso(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.ConditionalBinaryCheck("op_BitwiseAnd", left, right, method);
|
||||
return Expression.MakeBoolBinary(ExpressionType.AndAlso, left, right, true, method);
|
||||
}
|
||||
|
||||
// Token: 0x0600003D RID: 61 RVA: 0x00002EB4 File Offset: 0x000010B4
|
||||
private static MethodInfo ConditionalBinaryCheck(string oper, Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck(oper, left, right, method);
|
||||
if (method == null)
|
||||
{
|
||||
if (left.Type.GetNotNullableType() != typeof(bool))
|
||||
{
|
||||
throw new InvalidOperationException("Only booleans are allowed");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Type notNullableType = left.Type.GetNotNullableType();
|
||||
if (left.Type != right.Type || method.ReturnType != notNullableType)
|
||||
{
|
||||
throw new ArgumentException("left, right and return type must match");
|
||||
}
|
||||
MethodInfo trueOperator = Expression.GetTrueOperator(notNullableType);
|
||||
MethodInfo falseOperator = Expression.GetFalseOperator(notNullableType);
|
||||
if (trueOperator == null || falseOperator == null)
|
||||
{
|
||||
throw new ArgumentException("Operators true and false are required but not defined");
|
||||
}
|
||||
}
|
||||
return method;
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a conditional OR operation that evaluates the second operand only if it has to.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.OrElse" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The bitwise OR operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.-or-<paramref name="left" />.Type and <paramref name="right" />.Type are not the same Boolean type.</exception>
|
||||
// Token: 0x0600003E RID: 62 RVA: 0x00002F58 File Offset: 0x00001158
|
||||
public static BinaryExpression OrElse(Expression left, Expression right)
|
||||
{
|
||||
return Expression.OrElse(left, right, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a conditional OR operation that evaluates the second operand only if it has to. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.OrElse" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the bitwise OR operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.-or-<paramref name="method" /> is null and <paramref name="left" />.Type and <paramref name="right" />.Type are not the same Boolean type.</exception>
|
||||
// Token: 0x0600003F RID: 63 RVA: 0x00002F64 File Offset: 0x00001164
|
||||
public static BinaryExpression OrElse(Expression left, Expression right, MethodInfo method)
|
||||
{
|
||||
method = Expression.ConditionalBinaryCheck("op_BitwiseOr", left, right, method);
|
||||
return Expression.MakeBoolBinary(ExpressionType.OrElse, left, right, true, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an equality comparison.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Equal" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The equality operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000040 RID: 64 RVA: 0x00002F80 File Offset: 0x00001180
|
||||
public static BinaryExpression Equal(Expression left, Expression right)
|
||||
{
|
||||
return Expression.Equal(left, right, false, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an equality comparison. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Equal" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the equality operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000041 RID: 65 RVA: 0x00002F8C File Offset: 0x0000118C
|
||||
public static BinaryExpression Equal(Expression left, Expression right, bool liftToNull, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_Equality", left, right, method);
|
||||
return Expression.MakeBoolBinary(ExpressionType.Equal, left, right, liftToNull, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an inequality comparison.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NotEqual" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The inequality operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000042 RID: 66 RVA: 0x00002FA8 File Offset: 0x000011A8
|
||||
public static BinaryExpression NotEqual(Expression left, Expression right)
|
||||
{
|
||||
return Expression.NotEqual(left, right, false, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents an inequality comparison. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NotEqual" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the inequality operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000043 RID: 67 RVA: 0x00002FB4 File Offset: 0x000011B4
|
||||
public static BinaryExpression NotEqual(Expression left, Expression right, bool liftToNull, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_Inequality", left, right, method);
|
||||
return Expression.MakeBoolBinary(ExpressionType.NotEqual, left, right, liftToNull, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a "greater than" numeric comparison.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.GreaterThan" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The "greater than" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000044 RID: 68 RVA: 0x00002FD0 File Offset: 0x000011D0
|
||||
public static BinaryExpression GreaterThan(Expression left, Expression right)
|
||||
{
|
||||
return Expression.GreaterThan(left, right, false, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a "greater than" numeric comparison. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.GreaterThan" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the "greater than" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000045 RID: 69 RVA: 0x00002FDC File Offset: 0x000011DC
|
||||
public static BinaryExpression GreaterThan(Expression left, Expression right, bool liftToNull, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_GreaterThan", left, right, method);
|
||||
return Expression.MakeBoolBinary(ExpressionType.GreaterThan, left, right, liftToNull, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a "greater than or equal" numeric comparison.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.GreaterThanOrEqual" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The "greater than or equal" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000046 RID: 70 RVA: 0x00002FF8 File Offset: 0x000011F8
|
||||
public static BinaryExpression GreaterThanOrEqual(Expression left, Expression right)
|
||||
{
|
||||
return Expression.GreaterThanOrEqual(left, right, false, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a "greater than or equal" numeric comparison. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.GreaterThanOrEqual" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the "greater than or equal" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000047 RID: 71 RVA: 0x00003004 File Offset: 0x00001204
|
||||
public static BinaryExpression GreaterThanOrEqual(Expression left, Expression right, bool liftToNull, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_GreaterThanOrEqual", left, right, method);
|
||||
return Expression.MakeBoolBinary(ExpressionType.GreaterThanOrEqual, left, right, liftToNull, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a "less than" numeric comparison.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.LessThan" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The "less than" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000048 RID: 72 RVA: 0x00003020 File Offset: 0x00001220
|
||||
public static BinaryExpression LessThan(Expression left, Expression right)
|
||||
{
|
||||
return Expression.LessThan(left, right, false, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a "less than" numeric comparison. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.LessThan" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the "less than" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x06000049 RID: 73 RVA: 0x0000302C File Offset: 0x0000122C
|
||||
public static BinaryExpression LessThan(Expression left, Expression right, bool liftToNull, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_LessThan", left, right, method);
|
||||
return Expression.MakeBoolBinary(ExpressionType.LessThan, left, right, liftToNull, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a " less than or equal" numeric comparison.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.LessThanOrEqual" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The "less than or equal" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x0600004A RID: 74 RVA: 0x00003048 File Offset: 0x00001248
|
||||
public static BinaryExpression LessThanOrEqual(Expression left, Expression right)
|
||||
{
|
||||
return Expression.LessThanOrEqual(left, right, false, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a " less than or equal" numeric comparison. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.LessThanOrEqual" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" />, <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" />, and <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly two arguments.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the "less than or equal" operator is not defined for <paramref name="left" />.Type and <paramref name="right" />.Type.</exception>
|
||||
// Token: 0x0600004B RID: 75 RVA: 0x00003054 File Offset: 0x00001254
|
||||
public static BinaryExpression LessThanOrEqual(Expression left, Expression right, bool liftToNull, MethodInfo method)
|
||||
{
|
||||
method = Expression.BinaryCoreCheck("op_LessThanOrEqual", left, right, method);
|
||||
return Expression.MakeBoolBinary(ExpressionType.LessThanOrEqual, left, right, liftToNull, method);
|
||||
}
|
||||
|
||||
// Token: 0x0600004C RID: 76 RVA: 0x00003070 File Offset: 0x00001270
|
||||
private static void CheckArray(Expression array)
|
||||
{
|
||||
if (array == null)
|
||||
{
|
||||
throw new ArgumentNullException("array");
|
||||
}
|
||||
if (!array.Type.IsArray)
|
||||
{
|
||||
throw new ArgumentException("The array argument must be of type array");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents applying an array index operator to an array of rank one.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ArrayIndex" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="array">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="index">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="array" /> or <paramref name="index" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="array" />.Type does not represent an array type.-or-<paramref name="array" />.Type represents an array type whose rank is not 1.-or-<paramref name="index" />.Type does not represent the <see cref="T:System.Int32" /> type.</exception>
|
||||
// Token: 0x0600004D RID: 77 RVA: 0x000030AC File Offset: 0x000012AC
|
||||
public static BinaryExpression ArrayIndex(Expression array, Expression index)
|
||||
{
|
||||
Expression.CheckArray(array);
|
||||
if (index == null)
|
||||
{
|
||||
throw new ArgumentNullException("index");
|
||||
}
|
||||
if (array.Type.GetArrayRank() != 1)
|
||||
{
|
||||
throw new ArgumentException("The array argument must be a single dimensional array");
|
||||
}
|
||||
if (index.Type != typeof(int))
|
||||
{
|
||||
throw new ArgumentException("The index must be of type int");
|
||||
}
|
||||
return new BinaryExpression(ExpressionType.ArrayIndex, array.Type.GetElementType(), array, index);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a coalescing operation.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Coalesce" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of <paramref name="left" /> does not represent a reference type or a nullable value type.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="left" />.Type and <paramref name="right" />.Type are not convertible to each other.</exception>
|
||||
// Token: 0x0600004E RID: 78 RVA: 0x00003120 File Offset: 0x00001320
|
||||
public static BinaryExpression Coalesce(Expression left, Expression right)
|
||||
{
|
||||
return Expression.Coalesce(left, right, null);
|
||||
}
|
||||
|
||||
// Token: 0x0600004F RID: 79 RVA: 0x0000312C File Offset: 0x0000132C
|
||||
private static BinaryExpression MakeCoalesce(Expression left, Expression right)
|
||||
{
|
||||
Type type = null;
|
||||
if (left.Type.IsNullable())
|
||||
{
|
||||
Type notNullableType = left.Type.GetNotNullableType();
|
||||
if (!right.Type.IsNullable() && right.Type.IsAssignableTo(notNullableType))
|
||||
{
|
||||
type = notNullableType;
|
||||
}
|
||||
}
|
||||
if (type == null && right.Type.IsAssignableTo(left.Type))
|
||||
{
|
||||
type = left.Type;
|
||||
}
|
||||
if (type == null && left.Type.IsNullable() && left.Type.GetNotNullableType().IsAssignableTo(right.Type))
|
||||
{
|
||||
type = right.Type;
|
||||
}
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentException("Incompatible argument types");
|
||||
}
|
||||
return new BinaryExpression(ExpressionType.Coalesce, type, left, right, false, false, null, null);
|
||||
}
|
||||
|
||||
// Token: 0x06000050 RID: 80 RVA: 0x000031F4 File Offset: 0x000013F4
|
||||
private static BinaryExpression MakeConvertedCoalesce(Expression left, Expression right, LambdaExpression conversion)
|
||||
{
|
||||
MethodInfo invokeMethod = conversion.Type.GetInvokeMethod();
|
||||
Expression.CheckNotVoid(invokeMethod.ReturnType);
|
||||
if (invokeMethod.ReturnType != right.Type)
|
||||
{
|
||||
throw new InvalidOperationException("Conversion return type doesn't march right type");
|
||||
}
|
||||
ParameterInfo[] parameters = invokeMethod.GetParameters();
|
||||
if (parameters.Length != 1)
|
||||
{
|
||||
throw new ArgumentException("Conversion has wrong number of parameters");
|
||||
}
|
||||
if (!Expression.IsAssignableToParameterType(left.Type, parameters[0]))
|
||||
{
|
||||
throw new InvalidOperationException("Conversion argument doesn't marcht left type");
|
||||
}
|
||||
return new BinaryExpression(ExpressionType.Coalesce, right.Type, left, right, false, false, null, conversion);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" /> that represents a coalescing operation, given a conversion function.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.BinaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Coalesce" /> and the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" />, <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> and <see cref="P:System.Linq.Expressions.BinaryExpression.Conversion" /> properties set to the specified values.</returns>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Left" /> property equal to.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Right" /> property equal to.</param>
|
||||
/// <param name="conversion">A <see cref="T:System.Linq.Expressions.LambdaExpression" /> to set the <see cref="P:System.Linq.Expressions.BinaryExpression.Conversion" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="left" />.Type and <paramref name="right" />.Type are not convertible to each other.-or-<paramref name="conversion" /> is not null and <paramref name="conversion" />.Type is a delegate type that does not take exactly one argument.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of <paramref name="left" /> does not represent a reference type or a nullable value type.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of <paramref name="left" /> represents a type that is not assignable to the parameter type of the delegate type <paramref name="conversion" />.Type.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of <paramref name="right" /> is not equal to the return type of the delegate type <paramref name="conversion" />.Type.</exception>
|
||||
// Token: 0x06000051 RID: 81 RVA: 0x00003280 File Offset: 0x00001480
|
||||
public static BinaryExpression Coalesce(Expression left, Expression right, LambdaExpression conversion)
|
||||
{
|
||||
if (left == null)
|
||||
{
|
||||
throw new ArgumentNullException("left");
|
||||
}
|
||||
if (right == null)
|
||||
{
|
||||
throw new ArgumentNullException("right");
|
||||
}
|
||||
if (left.Type.IsValueType && !left.Type.IsNullable())
|
||||
{
|
||||
throw new InvalidOperationException("Left expression can never be null");
|
||||
}
|
||||
if (conversion != null)
|
||||
{
|
||||
return Expression.MakeConvertedCoalesce(left, right, conversion);
|
||||
}
|
||||
return Expression.MakeCoalesce(left, right);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" />, given the left and right operands, by calling an appropriate factory method.</summary>
|
||||
/// <returns>The <see cref="T:System.Linq.Expressions.BinaryExpression" /> that results from calling the appropriate factory method.</returns>
|
||||
/// <param name="binaryType">The <see cref="T:System.Linq.Expressions.ExpressionType" /> that specifies the type of binary operation.</param>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the left operand.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the right operand.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="binaryType" /> does not correspond to a binary expression node.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
// Token: 0x06000052 RID: 82 RVA: 0x000032F0 File Offset: 0x000014F0
|
||||
public static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right)
|
||||
{
|
||||
return Expression.MakeBinary(binaryType, left, right, false, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" />, given the left operand, right operand and implementing method, by calling the appropriate factory method.</summary>
|
||||
/// <returns>The <see cref="T:System.Linq.Expressions.BinaryExpression" /> that results from calling the appropriate factory method.</returns>
|
||||
/// <param name="binaryType">The <see cref="T:System.Linq.Expressions.ExpressionType" /> that specifies the type of binary operation.</param>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the left operand.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the right operand.</param>
|
||||
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> that specifies the implementing method.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="binaryType" /> does not correspond to a binary expression node.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
// Token: 0x06000053 RID: 83 RVA: 0x000032FC File Offset: 0x000014FC
|
||||
public static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method)
|
||||
{
|
||||
return Expression.MakeBinary(binaryType, left, right, liftToNull, method, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.BinaryExpression" />, given the left operand, right operand, implementing method and type conversion function, by calling the appropriate factory method.</summary>
|
||||
/// <returns>The <see cref="T:System.Linq.Expressions.BinaryExpression" /> that results from calling the appropriate factory method.</returns>
|
||||
/// <param name="binaryType">The <see cref="T:System.Linq.Expressions.ExpressionType" /> that specifies the type of binary operation.</param>
|
||||
/// <param name="left">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the left operand.</param>
|
||||
/// <param name="right">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the right operand.</param>
|
||||
/// <param name="liftToNull">true to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to true; false to set <see cref="P:System.Linq.Expressions.BinaryExpression.IsLiftedToNull" /> to false.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> that specifies the implementing method.</param>
|
||||
/// <param name="conversion">A <see cref="T:System.Linq.Expressions.LambdaExpression" /> that represents a type conversion function. This parameter is used only if <paramref name="binaryType" /> is <see cref="F:System.Linq.Expressions.ExpressionType.Coalesce" />.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="binaryType" /> does not correspond to a binary expression node.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="left" /> or <paramref name="right" /> is null.</exception>
|
||||
// Token: 0x06000054 RID: 84 RVA: 0x0000330C File Offset: 0x0000150C
|
||||
public static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method, LambdaExpression conversion)
|
||||
{
|
||||
switch (binaryType)
|
||||
{
|
||||
case ExpressionType.Add:
|
||||
return Expression.Add(left, right, method);
|
||||
case ExpressionType.AddChecked:
|
||||
return Expression.AddChecked(left, right, method);
|
||||
case ExpressionType.And:
|
||||
return Expression.And(left, right, method);
|
||||
case ExpressionType.AndAlso:
|
||||
return Expression.AndAlso(left, right);
|
||||
case ExpressionType.Coalesce:
|
||||
return Expression.Coalesce(left, right, conversion);
|
||||
case ExpressionType.Divide:
|
||||
return Expression.Divide(left, right, method);
|
||||
case ExpressionType.Equal:
|
||||
return Expression.Equal(left, right, liftToNull, method);
|
||||
case ExpressionType.ExclusiveOr:
|
||||
return Expression.ExclusiveOr(left, right, method);
|
||||
case ExpressionType.GreaterThan:
|
||||
return Expression.GreaterThan(left, right, liftToNull, method);
|
||||
case ExpressionType.GreaterThanOrEqual:
|
||||
return Expression.GreaterThanOrEqual(left, right, liftToNull, method);
|
||||
case ExpressionType.LeftShift:
|
||||
return Expression.LeftShift(left, right, method);
|
||||
case ExpressionType.LessThan:
|
||||
return Expression.LessThan(left, right, liftToNull, method);
|
||||
case ExpressionType.LessThanOrEqual:
|
||||
return Expression.LessThanOrEqual(left, right, liftToNull, method);
|
||||
case ExpressionType.Modulo:
|
||||
return Expression.Modulo(left, right, method);
|
||||
case ExpressionType.Multiply:
|
||||
return Expression.Multiply(left, right, method);
|
||||
case ExpressionType.MultiplyChecked:
|
||||
return Expression.MultiplyChecked(left, right, method);
|
||||
case ExpressionType.NotEqual:
|
||||
return Expression.NotEqual(left, right, liftToNull, method);
|
||||
case ExpressionType.Or:
|
||||
return Expression.Or(left, right, method);
|
||||
case ExpressionType.OrElse:
|
||||
return Expression.OrElse(left, right);
|
||||
case ExpressionType.Power:
|
||||
return Expression.Power(left, right, method);
|
||||
case ExpressionType.RightShift:
|
||||
return Expression.RightShift(left, right, method);
|
||||
case ExpressionType.Subtract:
|
||||
return Expression.Subtract(left, right, method);
|
||||
case ExpressionType.SubtractChecked:
|
||||
return Expression.SubtractChecked(left, right, method);
|
||||
}
|
||||
throw new ArgumentException("MakeBinary expect a binary node type");
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents applying an array index operator to an array of rank more than one.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" /> and the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> and <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> properties set to the specified values.</returns>
|
||||
/// <param name="array">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> property equal to.</param>
|
||||
/// <param name="indexes">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="array" /> or <paramref name="indexes" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="array" />.Type does not represent an array type.-or-The rank of <paramref name="array" />.Type does not match the number of elements in <paramref name="indexes" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of one or more elements of <paramref name="indexes" /> does not represent the <see cref="T:System.Int32" /> type.</exception>
|
||||
// Token: 0x06000055 RID: 85 RVA: 0x000034C8 File Offset: 0x000016C8
|
||||
public static MethodCallExpression ArrayIndex(Expression array, params Expression[] indexes)
|
||||
{
|
||||
return Expression.ArrayIndex(array, indexes);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents applying an array index operator to an array of rank more than one.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" /> and the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> and <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> properties set to the specified values.</returns>
|
||||
/// <param name="array">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> property equal to.</param>
|
||||
/// <param name="indexes">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="array" /> or <paramref name="indexes" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="array" />.Type does not represent an array type.-or-The rank of <paramref name="array" />.Type does not match the number of elements in <paramref name="indexes" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of one or more elements of <paramref name="indexes" /> does not represent the <see cref="T:System.Int32" /> type.</exception>
|
||||
// Token: 0x06000056 RID: 86 RVA: 0x000034D4 File Offset: 0x000016D4
|
||||
public static MethodCallExpression ArrayIndex(Expression array, IEnumerable<Expression> indexes)
|
||||
{
|
||||
Expression.CheckArray(array);
|
||||
if (indexes == null)
|
||||
{
|
||||
throw new ArgumentNullException("indexes");
|
||||
}
|
||||
ReadOnlyCollection<Expression> readOnlyCollection = indexes.ToReadOnlyCollection<Expression>();
|
||||
if (array.Type.GetArrayRank() != readOnlyCollection.Count)
|
||||
{
|
||||
throw new ArgumentException("The number of arguments doesn't match the rank of the array");
|
||||
}
|
||||
foreach (Expression expression in readOnlyCollection)
|
||||
{
|
||||
if (expression.Type != typeof(int))
|
||||
{
|
||||
throw new ArgumentException("The index must be of type int");
|
||||
}
|
||||
}
|
||||
return Expression.Call(array, array.Type.GetMethod("Get", BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy), readOnlyCollection);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents getting the length of a one-dimensional array.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ArrayLength" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to <paramref name="array" />.</returns>
|
||||
/// <param name="array">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="array" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="array" />.Type does not represent an array type.</exception>
|
||||
// Token: 0x06000057 RID: 87 RVA: 0x000035A4 File Offset: 0x000017A4
|
||||
public static UnaryExpression ArrayLength(Expression array)
|
||||
{
|
||||
if (array == null)
|
||||
{
|
||||
throw new ArgumentNullException("array");
|
||||
}
|
||||
if (!array.Type.IsArray)
|
||||
{
|
||||
throw new ArgumentException("The type of the expression must me Array");
|
||||
}
|
||||
if (array.Type.GetArrayRank() != 1)
|
||||
{
|
||||
throw new ArgumentException("The array must be a single dimensional array");
|
||||
}
|
||||
return new UnaryExpression(ExpressionType.ArrayLength, array, typeof(int));
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberAssignment" /> that represents the initialization of a field or property.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberAssignment" /> that has <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> equal to <see cref="F:System.Linq.Expressions.MemberBindingType.Assignment" /> and the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> and <see cref="P:System.Linq.Expressions.MemberAssignment.Expression" /> properties set to the specified values.</returns>
|
||||
/// <param name="member">A <see cref="T:System.Reflection.MemberInfo" /> to set the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property equal to.</param>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MemberAssignment.Expression" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="member" /> or <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="member" /> does not represent a field or property.-or-The property represented by <paramref name="member" /> does not have a set accessor.-or-<paramref name="expression" />.Type is not assignable to the type of the field or property that <paramref name="member" /> represents.</exception>
|
||||
// Token: 0x06000058 RID: 88 RVA: 0x0000360C File Offset: 0x0000180C
|
||||
public static MemberAssignment Bind(MemberInfo member, Expression expression)
|
||||
{
|
||||
if (member == null)
|
||||
{
|
||||
throw new ArgumentNullException("member");
|
||||
}
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
Type type = null;
|
||||
PropertyInfo propertyInfo = member as PropertyInfo;
|
||||
if (propertyInfo != null && propertyInfo.GetSetMethod(true) != null)
|
||||
{
|
||||
type = propertyInfo.PropertyType;
|
||||
}
|
||||
FieldInfo fieldInfo = member as FieldInfo;
|
||||
if (fieldInfo != null)
|
||||
{
|
||||
type = fieldInfo.FieldType;
|
||||
}
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentException("member");
|
||||
}
|
||||
if (!expression.Type.IsAssignableTo(type))
|
||||
{
|
||||
throw new ArgumentException("member");
|
||||
}
|
||||
return new MemberAssignment(member, expression);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberAssignment" /> that represents the initialization of a member by using a property accessor method.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberAssignment" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.Assignment" />, the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property set to the <see cref="T:System.Reflection.PropertyInfo" /> that represents the property accessed in <paramref name="propertyAccessor" />, and the <see cref="P:System.Linq.Expressions.MemberAssignment.Expression" /> property set to <paramref name="expression" />.</returns>
|
||||
/// <param name="propertyAccessor">A <see cref="T:System.Reflection.MethodInfo" /> that represents a property accessor method.</param>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MemberAssignment.Expression" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="propertyAccessor" /> or <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="propertyAccessor" /> does not represent a property accessor method.-or-The property accessed by <paramref name="propertyAccessor" /> does not have a set accessor.-or-<paramref name="expression" />.Type is not assignable to the type of the field or property that <paramref name="member" /> represents.</exception>
|
||||
// Token: 0x06000059 RID: 89 RVA: 0x000036A8 File Offset: 0x000018A8
|
||||
public static MemberAssignment Bind(MethodInfo propertyAccessor, Expression expression)
|
||||
{
|
||||
if (propertyAccessor == null)
|
||||
{
|
||||
throw new ArgumentNullException("propertyAccessor");
|
||||
}
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
Expression.CheckNonGenericMethod(propertyAccessor);
|
||||
PropertyInfo associatedProperty = Expression.GetAssociatedProperty(propertyAccessor);
|
||||
if (associatedProperty == null)
|
||||
{
|
||||
throw new ArgumentException("propertyAccessor");
|
||||
}
|
||||
if (associatedProperty.GetSetMethod(true) == null)
|
||||
{
|
||||
throw new ArgumentException("setter");
|
||||
}
|
||||
if (!expression.Type.IsAssignableTo(associatedProperty.PropertyType))
|
||||
{
|
||||
throw new ArgumentException("member");
|
||||
}
|
||||
return new MemberAssignment(associatedProperty, expression);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents a call to a method that takes no arguments.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" /> and the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> and <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="instance">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> property equal to (pass null for a static (Shared in Visual Basic) method).</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="method" /> is null.-or-<paramref name="instance" /> is null and <paramref name="method" /> represents an instance method.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="instance" />.Type is not assignable to the declaring type of the method represented by <paramref name="method" />.</exception>
|
||||
// Token: 0x0600005A RID: 90 RVA: 0x00003738 File Offset: 0x00001938
|
||||
public static MethodCallExpression Call(Expression instance, MethodInfo method)
|
||||
{
|
||||
return Expression.Call(instance, method, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents a call to a static (Shared in Visual Basic) method.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" /> and the <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> and <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> properties set to the specified values.</returns>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> that represents a static (Shared in Visual Basic) method to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> property equal to.</param>
|
||||
/// <param name="arguments">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="method" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The number of elements in <paramref name="arguments" /> does not equal the number of parameters for the method represented by <paramref name="method" />.-or-One or more of the elements of <paramref name="arguments" /> is not assignable to the corresponding parameter for the method represented by <paramref name="method" />.</exception>
|
||||
// Token: 0x0600005B RID: 91 RVA: 0x00003744 File Offset: 0x00001944
|
||||
public static MethodCallExpression Call(MethodInfo method, params Expression[] arguments)
|
||||
{
|
||||
return Expression.Call(null, method, arguments);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents a call to a method that takes arguments.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" /> and the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" />, <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" />, and <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> properties set to the specified values.</returns>
|
||||
/// <param name="instance">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> property equal to (pass null for a static (Shared in Visual Basic) method).</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> property equal to.</param>
|
||||
/// <param name="arguments">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="method" /> is null.-or-<paramref name="instance" /> is null and <paramref name="method" /> represents an instance method.-or-<paramref name="arguments" /> is not null and one or more of its elements is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="instance" />.Type is not assignable to the declaring type of the method represented by <paramref name="method" />.-or-The number of elements in <paramref name="arguments" /> does not equal the number of parameters for the method represented by <paramref name="method" />.-or-One or more of the elements of <paramref name="arguments" /> is not assignable to the corresponding parameter for the method represented by <paramref name="method" />.</exception>
|
||||
// Token: 0x0600005C RID: 92 RVA: 0x00003750 File Offset: 0x00001950
|
||||
public static MethodCallExpression Call(Expression instance, MethodInfo method, params Expression[] arguments)
|
||||
{
|
||||
return Expression.Call(instance, method, arguments);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents a call to a method that takes arguments.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" /> and the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" />, <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" />, and <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> properties set to the specified values.</returns>
|
||||
/// <param name="instance">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> property equal to (pass null for a static (Shared in Visual Basic) method).</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> property equal to.</param>
|
||||
/// <param name="arguments">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="method" /> is null.-or-<paramref name="instance" /> is null and <paramref name="method" /> represents an instance method.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="instance" />.Type is not assignable to the declaring type of the method represented by <paramref name="method" />.-or-The number of elements in <paramref name="arguments" /> does not equal the number of parameters for the method represented by <paramref name="method" />.-or-One or more of the elements of <paramref name="arguments" /> is not assignable to the corresponding parameter for the method represented by <paramref name="method" />.</exception>
|
||||
// Token: 0x0600005D RID: 93 RVA: 0x0000375C File Offset: 0x0000195C
|
||||
public static MethodCallExpression Call(Expression instance, MethodInfo method, IEnumerable<Expression> arguments)
|
||||
{
|
||||
if (method == null)
|
||||
{
|
||||
throw new ArgumentNullException("method");
|
||||
}
|
||||
if (instance == null && !method.IsStatic)
|
||||
{
|
||||
throw new ArgumentNullException("instance");
|
||||
}
|
||||
if (method.IsStatic && instance != null)
|
||||
{
|
||||
throw new ArgumentException("instance");
|
||||
}
|
||||
if (!method.IsStatic && !instance.Type.IsAssignableTo(method.DeclaringType))
|
||||
{
|
||||
throw new ArgumentException("Type is not assignable to the declaring type of the method");
|
||||
}
|
||||
ReadOnlyCollection<Expression> readOnlyCollection = Expression.CheckMethodArguments(method, arguments);
|
||||
return new MethodCallExpression(instance, method, readOnlyCollection);
|
||||
}
|
||||
|
||||
// Token: 0x0600005E RID: 94 RVA: 0x000037F0 File Offset: 0x000019F0
|
||||
private static Type[] CollectTypes(IEnumerable<Expression> expressions)
|
||||
{
|
||||
return expressions.Select((Expression arg) => arg.Type).ToArray<Type>();
|
||||
}
|
||||
|
||||
// Token: 0x0600005F RID: 95 RVA: 0x00003828 File Offset: 0x00001A28
|
||||
private static MethodInfo TryMakeGeneric(MethodInfo method, Type[] args)
|
||||
{
|
||||
if (method == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (!method.IsGenericMethod && (args == null || args.Length == 0))
|
||||
{
|
||||
return method;
|
||||
}
|
||||
if (args.Length == method.GetGenericArguments().Length)
|
||||
{
|
||||
return method.MakeGenericMethod(args);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents a call to an instance method by calling the appropriate factory method.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" />, the <see cref="P:System.Linq.Expressions.MethodCallExpression.Object" /> property equal to <paramref name="instance" />, <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> set to the <see cref="T:System.Reflection.MethodInfo" /> that represents the specified instance method, and <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> set to the specified arguments.</returns>
|
||||
/// <param name="instance">An <see cref="T:System.Linq.Expressions.Expression" /> whose <see cref="P:System.Linq.Expressions.Expression.Type" /> property value will be searched for a specific method.</param>
|
||||
/// <param name="methodName">The name of the method.</param>
|
||||
/// <param name="typeArguments">An array of <see cref="T:System.Type" /> objects that specify the type parameters of the method.</param>
|
||||
/// <param name="arguments">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects that represents the arguments to the method.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="instance" /> or <paramref name="methodName" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">No method whose name is <paramref name="methodName" />, whose type parameters match <paramref name="typeArguments" />, and whose parameter types match <paramref name="arguments" /> is found in <paramref name="instance" />.Type or its base types.-or-More than one method whose name is <paramref name="methodName" />, whose type parameters match <paramref name="typeArguments" />, and whose parameter types match <paramref name="arguments" /> is found in <paramref name="instance" />.Type or its base types.</exception>
|
||||
// Token: 0x06000060 RID: 96 RVA: 0x00003874 File Offset: 0x00001A74
|
||||
public static MethodCallExpression Call(Expression instance, string methodName, Type[] typeArguments, params Expression[] arguments)
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
throw new ArgumentNullException("instance");
|
||||
}
|
||||
if (methodName == null)
|
||||
{
|
||||
throw new ArgumentNullException("methodName");
|
||||
}
|
||||
MethodInfo methodInfo = Expression.TryGetMethod(instance.Type, methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy, Expression.CollectTypes(arguments), typeArguments);
|
||||
ReadOnlyCollection<Expression> readOnlyCollection = Expression.CheckMethodArguments(methodInfo, arguments);
|
||||
return new MethodCallExpression(instance, methodInfo, readOnlyCollection);
|
||||
}
|
||||
|
||||
// Token: 0x06000061 RID: 97 RVA: 0x000038CC File Offset: 0x00001ACC
|
||||
private static bool MethodMatch(MethodInfo method, string name, Type[] parameterTypes, Type[] argumentTypes)
|
||||
{
|
||||
if (method.Name != name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
ParameterInfo[] parameters = method.GetParameters();
|
||||
if (parameters.Length != parameterTypes.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (method.IsGenericMethod && method.IsGenericMethodDefinition)
|
||||
{
|
||||
MethodInfo methodInfo = Expression.TryMakeGeneric(method, argumentTypes);
|
||||
return methodInfo != null && Expression.MethodMatch(methodInfo, name, parameterTypes, argumentTypes);
|
||||
}
|
||||
if (!method.IsGenericMethod && argumentTypes != null && argumentTypes.Length > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < parameters.Length; i++)
|
||||
{
|
||||
Type type = parameterTypes[i];
|
||||
ParameterInfo parameterInfo = parameters[i];
|
||||
if (!Expression.IsAssignableToParameterType(type, parameterInfo) && !Expression.IsExpressionOfParameter(type, parameterInfo.ParameterType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x06000062 RID: 98 RVA: 0x0000398C File Offset: 0x00001B8C
|
||||
private static bool IsExpressionOfParameter(Type type, Type ptype)
|
||||
{
|
||||
return ptype.IsGenericInstanceOf(typeof(Expression<>)) && ptype.GetFirstGenericArgument() == type;
|
||||
}
|
||||
|
||||
// Token: 0x06000063 RID: 99 RVA: 0x000039B0 File Offset: 0x00001BB0
|
||||
private static MethodInfo TryGetMethod(Type type, string methodName, BindingFlags flags, Type[] parameterTypes, Type[] argumentTypes)
|
||||
{
|
||||
IEnumerable<MethodInfo> enumerable = from meth in type.GetMethods(flags)
|
||||
where Expression.MethodMatch(meth, methodName, parameterTypes, argumentTypes)
|
||||
select meth;
|
||||
if (enumerable.Count<MethodInfo>() > 1)
|
||||
{
|
||||
throw new InvalidOperationException("Too many method candidates");
|
||||
}
|
||||
MethodInfo methodInfo = Expression.TryMakeGeneric(enumerable.FirstOrDefault<MethodInfo>(), argumentTypes);
|
||||
if (methodInfo != null)
|
||||
{
|
||||
return methodInfo;
|
||||
}
|
||||
throw new InvalidOperationException("No such method");
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that represents a call to a static (Shared in Visual Basic) method by calling the appropriate factory method.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MethodCallExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Call" />, the <see cref="P:System.Linq.Expressions.MethodCallExpression.Method" /> property set to the <see cref="T:System.Reflection.MethodInfo" /> that represents the specified static (Shared in Visual Basic) method, and the <see cref="P:System.Linq.Expressions.MethodCallExpression.Arguments" /> property set to the specified arguments.</returns>
|
||||
/// <param name="type">The <see cref="T:System.Type" /> that specifies the type that contains the specified static (Shared in Visual Basic) method.</param>
|
||||
/// <param name="methodName">The name of the method.</param>
|
||||
/// <param name="typeArguments">An array of <see cref="T:System.Type" /> objects that specify the type parameters of the method.</param>
|
||||
/// <param name="arguments">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects that represent the arguments to the method.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="type" /> or <paramref name="methodName" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">No method whose name is <paramref name="methodName" />, whose type parameters match <paramref name="typeArguments" />, and whose parameter types match <paramref name="arguments" /> is found in <paramref name="type" /> or its base types.-or-More than one method whose name is <paramref name="methodName" />, whose type parameters match <paramref name="typeArguments" />, and whose parameter types match <paramref name="arguments" /> is found in <paramref name="type" /> or its base types.</exception>
|
||||
// Token: 0x06000064 RID: 100 RVA: 0x00003A30 File Offset: 0x00001C30
|
||||
public static MethodCallExpression Call(Type type, string methodName, Type[] typeArguments, params Expression[] arguments)
|
||||
{
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentNullException("type");
|
||||
}
|
||||
if (methodName == null)
|
||||
{
|
||||
throw new ArgumentNullException("methodName");
|
||||
}
|
||||
MethodInfo methodInfo = Expression.TryGetMethod(type, methodName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy, Expression.CollectTypes(arguments), typeArguments);
|
||||
ReadOnlyCollection<Expression> readOnlyCollection = Expression.CheckMethodArguments(methodInfo, arguments);
|
||||
return new MethodCallExpression(methodInfo, readOnlyCollection);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ConditionalExpression" />.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.ConditionalExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Conditional" /> and the <see cref="P:System.Linq.Expressions.ConditionalExpression.Test" />, <see cref="P:System.Linq.Expressions.ConditionalExpression.IfTrue" />, and <see cref="P:System.Linq.Expressions.ConditionalExpression.IfFalse" /> properties set to the specified values.</returns>
|
||||
/// <param name="test">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.ConditionalExpression.Test" /> property equal to.</param>
|
||||
/// <param name="ifTrue">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.ConditionalExpression.IfTrue" /> property equal to.</param>
|
||||
/// <param name="ifFalse">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.ConditionalExpression.IfFalse" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="test" /> or <paramref name="ifTrue" /> or <paramref name="ifFalse" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="test" />.Type is not <see cref="T:System.Boolean" />.-or-<paramref name="ifTrue" />.Type is not equal to <paramref name="ifFalse" />.Type.</exception>
|
||||
// Token: 0x06000065 RID: 101 RVA: 0x00003A80 File Offset: 0x00001C80
|
||||
public static ConditionalExpression Condition(Expression test, Expression ifTrue, Expression ifFalse)
|
||||
{
|
||||
if (test == null)
|
||||
{
|
||||
throw new ArgumentNullException("test");
|
||||
}
|
||||
if (ifTrue == null)
|
||||
{
|
||||
throw new ArgumentNullException("ifTrue");
|
||||
}
|
||||
if (ifFalse == null)
|
||||
{
|
||||
throw new ArgumentNullException("ifFalse");
|
||||
}
|
||||
if (test.Type != typeof(bool))
|
||||
{
|
||||
throw new ArgumentException("Test expression should be of type bool");
|
||||
}
|
||||
if (ifTrue.Type != ifFalse.Type)
|
||||
{
|
||||
throw new ArgumentException("The ifTrue and ifFalse type do not match");
|
||||
}
|
||||
return new ConditionalExpression(test, ifTrue, ifFalse);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ConstantExpression" /> that has the <see cref="P:System.Linq.Expressions.ConstantExpression.Value" /> property set to the specified value.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.ConstantExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Constant" /> and the <see cref="P:System.Linq.Expressions.ConstantExpression.Value" /> property set to the specified value.</returns>
|
||||
/// <param name="value">An <see cref="T:System.Object" /> to set the <see cref="P:System.Linq.Expressions.ConstantExpression.Value" /> property equal to.</param>
|
||||
// Token: 0x06000066 RID: 102 RVA: 0x00003B04 File Offset: 0x00001D04
|
||||
public static ConstantExpression Constant(object value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return new ConstantExpression(null, typeof(object));
|
||||
}
|
||||
return Expression.Constant(value, value.GetType());
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ConstantExpression" /> that has the <see cref="P:System.Linq.Expressions.ConstantExpression.Value" /> and <see cref="P:System.Linq.Expressions.Expression.Type" /> properties set to the specified values.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.ConstantExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Constant" /> and the <see cref="P:System.Linq.Expressions.ConstantExpression.Value" /> and <see cref="P:System.Linq.Expressions.Expression.Type" /> properties set to the specified values.</returns>
|
||||
/// <param name="value">An <see cref="T:System.Object" /> to set the <see cref="P:System.Linq.Expressions.ConstantExpression.Value" /> property equal to.</param>
|
||||
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.Expression.Type" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="type" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="value" /> is not null and <paramref name="type" /> is not assignable from the dynamic type of <paramref name="value" />.</exception>
|
||||
// Token: 0x06000067 RID: 103 RVA: 0x00003B2C File Offset: 0x00001D2C
|
||||
public static ConstantExpression Constant(object value, Type type)
|
||||
{
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentNullException("type");
|
||||
}
|
||||
if (value == null)
|
||||
{
|
||||
if (type.IsValueType && !type.IsNullable())
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
}
|
||||
else if ((!type.IsValueType || !type.IsNullable()) && !value.GetType().IsAssignableTo(type))
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
return new ConstantExpression(value, type);
|
||||
}
|
||||
|
||||
// Token: 0x06000068 RID: 104 RVA: 0x00003BA8 File Offset: 0x00001DA8
|
||||
private static bool IsConvertiblePrimitive(Type type)
|
||||
{
|
||||
Type notNullableType = type.GetNotNullableType();
|
||||
return notNullableType != typeof(bool) && (notNullableType.IsEnum || notNullableType.IsPrimitive);
|
||||
}
|
||||
|
||||
// Token: 0x06000069 RID: 105 RVA: 0x00003BE4 File Offset: 0x00001DE4
|
||||
internal static bool IsPrimitiveConversion(Type type, Type target)
|
||||
{
|
||||
return type == target || (type.IsNullable() && target == type.GetNotNullableType()) || (target.IsNullable() && type == target.GetNotNullableType()) || (Expression.IsConvertiblePrimitive(type) && Expression.IsConvertiblePrimitive(target));
|
||||
}
|
||||
|
||||
// Token: 0x0600006A RID: 106 RVA: 0x00003C48 File Offset: 0x00001E48
|
||||
internal static bool IsReferenceConversion(Type type, Type target)
|
||||
{
|
||||
return type == target || (type == typeof(object) || target == typeof(object)) || (type.IsInterface || target.IsInterface) || (!type.IsValueType && !target.IsValueType && (type.IsAssignableTo(target) || target.IsAssignableTo(type)));
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a conversion operation.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Convert" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> and <see cref="P:System.Linq.Expressions.Expression.Type" /> properties set to the specified values.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.Expression.Type" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> or <paramref name="type" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">No conversion operator is defined between <paramref name="expression" />.Type and <paramref name="type" />.</exception>
|
||||
// Token: 0x0600006B RID: 107 RVA: 0x00003CCC File Offset: 0x00001ECC
|
||||
public static UnaryExpression Convert(Expression expression, Type type)
|
||||
{
|
||||
return Expression.Convert(expression, type, null);
|
||||
}
|
||||
|
||||
// Token: 0x0600006C RID: 108 RVA: 0x00003CD8 File Offset: 0x00001ED8
|
||||
private static MethodInfo GetUserConversionMethod(Type type, Type target)
|
||||
{
|
||||
MethodInfo methodInfo = Expression.GetUnaryOperator("op_Explicit", type, type, target);
|
||||
if (methodInfo == null)
|
||||
{
|
||||
methodInfo = Expression.GetUnaryOperator("op_Implicit", type, type, target);
|
||||
}
|
||||
if (methodInfo == null)
|
||||
{
|
||||
methodInfo = Expression.GetUnaryOperator("op_Explicit", target, type, target);
|
||||
}
|
||||
if (methodInfo == null)
|
||||
{
|
||||
methodInfo = Expression.GetUnaryOperator("op_Implicit", target, type, target);
|
||||
}
|
||||
if (methodInfo == null)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
return methodInfo;
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a conversion operation for which the implementing method is specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Convert" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" />, <see cref="P:System.Linq.Expressions.Expression.Type" />, and <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.Expression.Type" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> or <paramref name="type" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument.</exception>
|
||||
/// <exception cref="T:System.Reflection.AmbiguousMatchException">More than one method that matches the <paramref name="method" /> description was found.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">No conversion operator is defined between <paramref name="expression" />.Type and <paramref name="type" />.-or-<paramref name="expression" />.Type is not assignable to the argument type of the method represented by <paramref name="method" />.-or-The return type of the method represented by <paramref name="method" /> is not assignable to <paramref name="type" />.-or-<paramref name="expression" />.Type or <paramref name="type" /> is a nullable value type and the corresponding non-nullable value type does not equal the argument type or the return type, respectively, of the method represented by <paramref name="method" />.</exception>
|
||||
// Token: 0x0600006D RID: 109 RVA: 0x00003D3C File Offset: 0x00001F3C
|
||||
public static UnaryExpression Convert(Expression expression, Type type, MethodInfo method)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentNullException("type");
|
||||
}
|
||||
Type type2 = expression.Type;
|
||||
if (method != null)
|
||||
{
|
||||
Expression.CheckUnaryMethod(method, type2);
|
||||
}
|
||||
else if (!Expression.IsPrimitiveConversion(type2, type) && !Expression.IsReferenceConversion(type2, type))
|
||||
{
|
||||
method = Expression.GetUserConversionMethod(type2, type);
|
||||
}
|
||||
return new UnaryExpression(ExpressionType.Convert, expression, type, method, Expression.IsConvertNodeLifted(method, expression, type));
|
||||
}
|
||||
|
||||
// Token: 0x0600006E RID: 110 RVA: 0x00003DB8 File Offset: 0x00001FB8
|
||||
private static bool IsConvertNodeLifted(MethodInfo method, Expression operand, Type target)
|
||||
{
|
||||
if (method == null)
|
||||
{
|
||||
return operand.Type.IsNullable() || target.IsNullable();
|
||||
}
|
||||
return (operand.Type.IsNullable() && !Expression.ParameterMatch(method, operand.Type)) || (target.IsNullable() && !Expression.ReturnTypeMatch(method, target));
|
||||
}
|
||||
|
||||
// Token: 0x0600006F RID: 111 RVA: 0x00003E24 File Offset: 0x00002024
|
||||
private static bool ParameterMatch(MethodInfo method, Type type)
|
||||
{
|
||||
return method.GetParameters()[0].ParameterType == type;
|
||||
}
|
||||
|
||||
// Token: 0x06000070 RID: 112 RVA: 0x00003E38 File Offset: 0x00002038
|
||||
private static bool ReturnTypeMatch(MethodInfo method, Type type)
|
||||
{
|
||||
return method.ReturnType == type;
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a conversion operation that throws an exception if the target type is overflowed.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ConvertChecked" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> and <see cref="P:System.Linq.Expressions.Expression.Type" /> properties set to the specified values.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.Expression.Type" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> or <paramref name="type" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">No conversion operator is defined between <paramref name="expression" />.Type and <paramref name="type" />.</exception>
|
||||
// Token: 0x06000071 RID: 113 RVA: 0x00003E44 File Offset: 0x00002044
|
||||
public static UnaryExpression ConvertChecked(Expression expression, Type type)
|
||||
{
|
||||
return Expression.ConvertChecked(expression, type, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a conversion operation that throws an exception if the target type is overflowed and for which the implementing method is specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ConvertChecked" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" />, <see cref="P:System.Linq.Expressions.Expression.Type" />, and <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.Expression.Type" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> or <paramref name="type" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument.</exception>
|
||||
/// <exception cref="T:System.Reflection.AmbiguousMatchException">More than one method that matches the <paramref name="method" /> description was found.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">No conversion operator is defined between <paramref name="expression" />.Type and <paramref name="type" />.-or-<paramref name="expression" />.Type is not assignable to the argument type of the method represented by <paramref name="method" />.-or-The return type of the method represented by <paramref name="method" /> is not assignable to <paramref name="type" />.-or-<paramref name="expression" />.Type or <paramref name="type" /> is a nullable value type and the corresponding non-nullable value type does not equal the argument type or the return type, respectively, of the method represented by <paramref name="method" />.</exception>
|
||||
// Token: 0x06000072 RID: 114 RVA: 0x00003E50 File Offset: 0x00002050
|
||||
public static UnaryExpression ConvertChecked(Expression expression, Type type, MethodInfo method)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentNullException("type");
|
||||
}
|
||||
Type type2 = expression.Type;
|
||||
if (method != null)
|
||||
{
|
||||
Expression.CheckUnaryMethod(method, type2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Expression.IsReferenceConversion(type2, type))
|
||||
{
|
||||
return Expression.Convert(expression, type, method);
|
||||
}
|
||||
if (!Expression.IsPrimitiveConversion(type2, type))
|
||||
{
|
||||
method = Expression.GetUserConversionMethod(type2, type);
|
||||
}
|
||||
}
|
||||
return new UnaryExpression(ExpressionType.ConvertChecked, expression, type, method, Expression.IsConvertNodeLifted(method, expression, type));
|
||||
}
|
||||
|
||||
/// <summary>Creates an <see cref="T:System.Linq.Expressions.ElementInit" />, given an array of values as the second argument.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.ElementInit" /> that has the <see cref="P:System.Linq.Expressions.ElementInit.AddMethod" /> and <see cref="P:System.Linq.Expressions.ElementInit.Arguments" /> properties set to the specified values.</returns>
|
||||
/// <param name="addMethod">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.ElementInit.AddMethod" /> property equal to.</param>
|
||||
/// <param name="arguments">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to set the <see cref="P:System.Linq.Expressions.ElementInit.Arguments" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="addMethod" /> or <paramref name="arguments" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The method that addMethod represents is not named "Add" (case insensitive).-or-The method that addMethod represents is not an instance method.-or-arguments does not contain the same number of elements as the number of parameters for the method that addMethod represents.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of one or more elements of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the method that <paramref name="addMethod" /> represents.</exception>
|
||||
// Token: 0x06000073 RID: 115 RVA: 0x00003ED8 File Offset: 0x000020D8
|
||||
public static ElementInit ElementInit(MethodInfo addMethod, params Expression[] arguments)
|
||||
{
|
||||
return Expression.ElementInit(addMethod, arguments);
|
||||
}
|
||||
|
||||
/// <summary>Creates an <see cref="T:System.Linq.Expressions.ElementInit" />, given an <see cref="T:System.Collections.Generic.IEnumerable`1" /> as the second argument.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.ElementInit" /> that has the <see cref="P:System.Linq.Expressions.ElementInit.AddMethod" /> and <see cref="P:System.Linq.Expressions.ElementInit.Arguments" /> properties set to the specified values.</returns>
|
||||
/// <param name="addMethod">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.ElementInit.AddMethod" /> property equal to.</param>
|
||||
/// <param name="arguments">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to set the <see cref="P:System.Linq.Expressions.ElementInit.Arguments" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="addMethod" /> or <paramref name="arguments" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The method that <paramref name="addMethod" /> represents is not named "Add" (case insensitive).-or-The method that <paramref name="addMethod" /> represents is not an instance method.-or-<paramref name="arguments" /> does not contain the same number of elements as the number of parameters for the method that <paramref name="addMethod" /> represents.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of one or more elements of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the method that <paramref name="addMethod" /> represents.</exception>
|
||||
// Token: 0x06000074 RID: 116 RVA: 0x00003EE4 File Offset: 0x000020E4
|
||||
public static ElementInit ElementInit(MethodInfo addMethod, IEnumerable<Expression> arguments)
|
||||
{
|
||||
if (addMethod == null)
|
||||
{
|
||||
throw new ArgumentNullException("addMethod");
|
||||
}
|
||||
if (arguments == null)
|
||||
{
|
||||
throw new ArgumentNullException("arguments");
|
||||
}
|
||||
if (addMethod.Name.ToLower(CultureInfo.InvariantCulture) != "add")
|
||||
{
|
||||
throw new ArgumentException("addMethod");
|
||||
}
|
||||
if (addMethod.IsStatic)
|
||||
{
|
||||
throw new ArgumentException("addMethod must be an instance method", "addMethod");
|
||||
}
|
||||
ReadOnlyCollection<Expression> readOnlyCollection = Expression.CheckMethodArguments(addMethod, arguments);
|
||||
return new ElementInit(addMethod, readOnlyCollection);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberExpression" /> that represents accessing a field.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberAccess" /> and the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> and <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> properties set to the specified values.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> property equal to.</param>
|
||||
/// <param name="field">The <see cref="T:System.Reflection.FieldInfo" /> to set the <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="field" /> is null.-or-The field represented by <paramref name="field" /> is not static (Shared in Visual Basic) and <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="expression" />.Type is not assignable to the declaring type of the field represented by <paramref name="field" />.</exception>
|
||||
// Token: 0x06000075 RID: 117 RVA: 0x00003F68 File Offset: 0x00002168
|
||||
public static MemberExpression Field(Expression expression, FieldInfo field)
|
||||
{
|
||||
if (field == null)
|
||||
{
|
||||
throw new ArgumentNullException("field");
|
||||
}
|
||||
if (!field.IsStatic)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
if (!expression.Type.IsAssignableTo(field.DeclaringType))
|
||||
{
|
||||
throw new ArgumentException("field");
|
||||
}
|
||||
}
|
||||
else if (expression != null)
|
||||
{
|
||||
throw new ArgumentException("expression");
|
||||
}
|
||||
return new MemberExpression(expression, field, field.FieldType);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberExpression" /> that represents accessing a field given the name of the field.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberAccess" />, the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> property set to <paramref name="expression" />, and the <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> property set to the <see cref="T:System.Reflection.FieldInfo" /> that represents the field denoted by <paramref name="fieldName" />.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> whose <see cref="P:System.Linq.Expressions.Expression.Type" /> contains a field named <paramref name="fieldName" />.</param>
|
||||
/// <param name="fieldName">The name of a field.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> or <paramref name="fieldName" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">No field named <paramref name="fieldName" /> is defined in <paramref name="expression" />.Type or its base types.</exception>
|
||||
// Token: 0x06000076 RID: 118 RVA: 0x00003FE8 File Offset: 0x000021E8
|
||||
public static MemberExpression Field(Expression expression, string fieldName)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
FieldInfo field = expression.Type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
|
||||
if (field == null)
|
||||
{
|
||||
throw new ArgumentException(string.Format("No field named {0} on {1}", fieldName, expression.Type));
|
||||
}
|
||||
return new MemberExpression(expression, field, field.FieldType);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Type" /> object that represents a generic System.Action delegate type that has specific type arguments.</summary>
|
||||
/// <returns>The type of a System.Action delegate that has the specified type arguments.</returns>
|
||||
/// <param name="typeArgs">An array of zero to four <see cref="T:System.Type" /> objects that specify the type arguments for the System.Action delegate type.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="typeArgs" /> contains more than four elements.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="typeArgs" /> is null.</exception>
|
||||
// Token: 0x06000077 RID: 119 RVA: 0x00004040 File Offset: 0x00002240
|
||||
public static Type GetActionType(params Type[] typeArgs)
|
||||
{
|
||||
if (typeArgs == null)
|
||||
{
|
||||
throw new ArgumentNullException("typeArgs");
|
||||
}
|
||||
if (typeArgs.Length > 4)
|
||||
{
|
||||
throw new ArgumentException("No Action type of this arity");
|
||||
}
|
||||
if (typeArgs.Length == 0)
|
||||
{
|
||||
return typeof(Action);
|
||||
}
|
||||
Type type = null;
|
||||
switch (typeArgs.Length)
|
||||
{
|
||||
case 1:
|
||||
type = typeof(Action<>);
|
||||
break;
|
||||
case 2:
|
||||
type = typeof(Action<, >);
|
||||
break;
|
||||
case 3:
|
||||
type = typeof(Action<, , >);
|
||||
break;
|
||||
case 4:
|
||||
type = typeof(Action<, , , >);
|
||||
break;
|
||||
}
|
||||
return type.MakeGenericType(typeArgs);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Type" /> object that represents a generic System.Func delegate type that has specific type arguments.</summary>
|
||||
/// <returns>The type of a System.Func delegate that has the specified type arguments.</returns>
|
||||
/// <param name="typeArgs">An array of one to five <see cref="T:System.Type" /> objects that specify the type arguments for the System.Func delegate type.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="typeArgs" /> contains less than one or more than five elements.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="typeArgs" /> is null.</exception>
|
||||
// Token: 0x06000078 RID: 120 RVA: 0x000040F0 File Offset: 0x000022F0
|
||||
public static Type GetFuncType(params Type[] typeArgs)
|
||||
{
|
||||
if (typeArgs == null)
|
||||
{
|
||||
throw new ArgumentNullException("typeArgs");
|
||||
}
|
||||
if (typeArgs.Length < 1 || typeArgs.Length > 5)
|
||||
{
|
||||
throw new ArgumentException("No Func type of this arity");
|
||||
}
|
||||
Type type = null;
|
||||
switch (typeArgs.Length)
|
||||
{
|
||||
case 1:
|
||||
type = typeof(Func<>);
|
||||
break;
|
||||
case 2:
|
||||
type = typeof(Func<, >);
|
||||
break;
|
||||
case 3:
|
||||
type = typeof(Func<, , >);
|
||||
break;
|
||||
case 4:
|
||||
type = typeof(Func<, , , >);
|
||||
break;
|
||||
case 5:
|
||||
type = typeof(Func<, , , , >);
|
||||
break;
|
||||
}
|
||||
return type.MakeGenericType(typeArgs);
|
||||
}
|
||||
|
||||
/// <summary>Creates an <see cref="T:System.Linq.Expressions.InvocationExpression" />.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.InvocationExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Invoke" /> and the <see cref="P:System.Linq.Expressions.InvocationExpression.Expression" /> and <see cref="P:System.Linq.Expressions.InvocationExpression.Arguments" /> properties set to the specified values.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.InvocationExpression.Expression" /> property equal to.</param>
|
||||
/// <param name="arguments">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.InvocationExpression.Arguments" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="expression" />.Type does not represent a delegate type or an <see cref="T:System.Linq.Expressions.Expression`1" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the delegate represented by <paramref name="expression" />.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="arguments" /> does not contain the same number of elements as the list of parameters for the delegate represented by <paramref name="expression" />.</exception>
|
||||
// Token: 0x06000079 RID: 121 RVA: 0x000041AC File Offset: 0x000023AC
|
||||
public static InvocationExpression Invoke(Expression expression, params Expression[] arguments)
|
||||
{
|
||||
return Expression.Invoke(expression, arguments);
|
||||
}
|
||||
|
||||
// Token: 0x0600007A RID: 122 RVA: 0x000041B8 File Offset: 0x000023B8
|
||||
private static Type GetInvokableType(Type t)
|
||||
{
|
||||
if (t.IsAssignableTo(typeof(Delegate)))
|
||||
{
|
||||
return t;
|
||||
}
|
||||
return Expression.GetGenericType(t, typeof(Expression<>));
|
||||
}
|
||||
|
||||
// Token: 0x0600007B RID: 123 RVA: 0x000041E4 File Offset: 0x000023E4
|
||||
private static Type GetGenericType(Type t, Type def)
|
||||
{
|
||||
if (t == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (t.IsGenericType && t.GetGenericTypeDefinition() == def)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
return Expression.GetGenericType(t.BaseType, def);
|
||||
}
|
||||
|
||||
/// <summary>Creates an <see cref="T:System.Linq.Expressions.InvocationExpression" />.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.InvocationExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Invoke" /> and the <see cref="P:System.Linq.Expressions.InvocationExpression.Expression" /> and <see cref="P:System.Linq.Expressions.InvocationExpression.Arguments" /> properties set to the specified values.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.InvocationExpression.Expression" /> property equal to.</param>
|
||||
/// <param name="arguments">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.InvocationExpression.Arguments" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="expression" />.Type does not represent a delegate type or an <see cref="T:System.Linq.Expressions.Expression`1" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the delegate represented by <paramref name="expression" />.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="arguments" /> does not contain the same number of elements as the list of parameters for the delegate represented by <paramref name="expression" />.</exception>
|
||||
// Token: 0x0600007C RID: 124 RVA: 0x00004220 File Offset: 0x00002420
|
||||
public static InvocationExpression Invoke(Expression expression, IEnumerable<Expression> arguments)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
Type invokableType = Expression.GetInvokableType(expression.Type);
|
||||
if (invokableType == null)
|
||||
{
|
||||
throw new ArgumentException("The type of the expression is not invokable");
|
||||
}
|
||||
ReadOnlyCollection<Expression> readOnlyCollection = arguments.ToReadOnlyCollection<Expression>();
|
||||
Expression.CheckForNull<Expression>(readOnlyCollection, "arguments");
|
||||
MethodInfo invokeMethod = invokableType.GetInvokeMethod();
|
||||
if (invokeMethod == null)
|
||||
{
|
||||
throw new ArgumentException("expression");
|
||||
}
|
||||
if (invokeMethod.GetParameters().Length != readOnlyCollection.Count)
|
||||
{
|
||||
throw new InvalidOperationException("Arguments count doesn't match parameters length");
|
||||
}
|
||||
readOnlyCollection = Expression.CheckMethodArguments(invokeMethod, readOnlyCollection);
|
||||
return new InvocationExpression(expression, invokeMethod.ReturnType, readOnlyCollection);
|
||||
}
|
||||
|
||||
// Token: 0x0600007D RID: 125 RVA: 0x000042B8 File Offset: 0x000024B8
|
||||
private static bool CanAssign(Type target, Type source)
|
||||
{
|
||||
return !(target.IsValueType ^ source.IsValueType) && source.IsAssignableTo(target);
|
||||
}
|
||||
|
||||
// Token: 0x0600007E RID: 126 RVA: 0x000042D8 File Offset: 0x000024D8
|
||||
private static Expression CheckLambda(Type delegateType, Expression body, ReadOnlyCollection<ParameterExpression> parameters)
|
||||
{
|
||||
if (!delegateType.IsSubclassOf(typeof(Delegate)))
|
||||
{
|
||||
throw new ArgumentException("delegateType");
|
||||
}
|
||||
MethodInfo invokeMethod = delegateType.GetInvokeMethod();
|
||||
if (invokeMethod == null)
|
||||
{
|
||||
throw new ArgumentException("delegate must contain an Invoke method", "delegateType");
|
||||
}
|
||||
ParameterInfo[] parameters2 = invokeMethod.GetParameters();
|
||||
if (parameters2.Length != parameters.Count)
|
||||
{
|
||||
throw new ArgumentException(string.Format("Different number of arguments in delegate {0}", delegateType), "delegateType");
|
||||
}
|
||||
for (int i = 0; i < parameters2.Length; i++)
|
||||
{
|
||||
ParameterExpression parameterExpression = parameters[i];
|
||||
if (parameterExpression == null)
|
||||
{
|
||||
throw new ArgumentNullException("parameters");
|
||||
}
|
||||
if (!Expression.CanAssign(parameterExpression.Type, parameters2[i].ParameterType))
|
||||
{
|
||||
throw new ArgumentException(string.Format("Can not assign a {0} to a {1}", parameters2[i].ParameterType, parameterExpression.Type));
|
||||
}
|
||||
}
|
||||
if (invokeMethod.ReturnType == typeof(void) || Expression.CanAssign(invokeMethod.ReturnType, body.Type))
|
||||
{
|
||||
return body;
|
||||
}
|
||||
if (invokeMethod.ReturnType.IsExpression())
|
||||
{
|
||||
return Expression.Quote(body);
|
||||
}
|
||||
throw new ArgumentException(string.Format("body type {0} can not be assigned to {1}", body.Type, invokeMethod.ReturnType));
|
||||
}
|
||||
|
||||
/// <summary>Creates an <see cref="T:System.Linq.Expressions.Expression`1" /> where the delegate type is known at compile time.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.Expression`1" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Lambda" /> and the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> and <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> properties set to the specified values.</returns>
|
||||
/// <param name="body">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> property equal to.</param>
|
||||
/// <param name="parameters">An array of <see cref="T:System.Linq.Expressions.ParameterExpression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> collection.</param>
|
||||
/// <typeparam name="TDelegate">A delegate type.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="body" /> is null.-or-One or more elements in <paramref name="parameters" /> are null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="TDelegate" /> is not a delegate type.-or-<paramref name="body" />.Type represents a type that is not assignable to the return type of <paramref name="TDelegate" />.-or-<paramref name="parameters" /> does not contain the same number of elements as the list of parameters for <paramref name="TDelegate" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="parameters" /> is not assignable from the type of the corresponding parameter type of <paramref name="TDelegate" />.</exception>
|
||||
// Token: 0x0600007F RID: 127 RVA: 0x00004410 File Offset: 0x00002610
|
||||
public static Expression<TDelegate> Lambda<TDelegate>(Expression body, params ParameterExpression[] parameters)
|
||||
{
|
||||
return Expression.Lambda<TDelegate>(body, parameters);
|
||||
}
|
||||
|
||||
/// <summary>Creates an <see cref="T:System.Linq.Expressions.Expression`1" /> where the delegate type is known at compile time.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.Expression`1" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Lambda" /> and the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> and <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> properties set to the specified values.</returns>
|
||||
/// <param name="body">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> property equal to.</param>
|
||||
/// <param name="parameters">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.ParameterExpression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> collection.</param>
|
||||
/// <typeparam name="TDelegate">A delegate type.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="body" /> is null.-or-One or more elements in <paramref name="parameters" /> are null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="TDelegate" /> is not a delegate type.-or-<paramref name="body" />.Type represents a type that is not assignable to the return type of <paramref name="TDelegate" />.-or-<paramref name="parameters" /> does not contain the same number of elements as the list of parameters for <paramref name="TDelegate" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="parameters" /> is not assignable from the type of the corresponding parameter type of <paramref name="TDelegate" />.</exception>
|
||||
// Token: 0x06000080 RID: 128 RVA: 0x0000441C File Offset: 0x0000261C
|
||||
public static Expression<TDelegate> Lambda<TDelegate>(Expression body, IEnumerable<ParameterExpression> parameters)
|
||||
{
|
||||
if (body == null)
|
||||
{
|
||||
throw new ArgumentNullException("body");
|
||||
}
|
||||
ReadOnlyCollection<ParameterExpression> readOnlyCollection = parameters.ToReadOnlyCollection<ParameterExpression>();
|
||||
body = Expression.CheckLambda(typeof(TDelegate), body, readOnlyCollection);
|
||||
return new Expression<TDelegate>(body, readOnlyCollection);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.LambdaExpression" /> by first constructing a delegate type.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.LambdaExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Lambda" /> and the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> and <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> properties set to the specified values.</returns>
|
||||
/// <param name="body">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> property equal to.</param>
|
||||
/// <param name="parameters">An array of <see cref="T:System.Linq.Expressions.ParameterExpression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="body" /> is null.-or-One or more elements of <paramref name="parameters" /> are null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="parameters" /> contains more than four elements.</exception>
|
||||
// Token: 0x06000081 RID: 129 RVA: 0x0000445C File Offset: 0x0000265C
|
||||
public static LambdaExpression Lambda(Expression body, params ParameterExpression[] parameters)
|
||||
{
|
||||
if (body == null)
|
||||
{
|
||||
throw new ArgumentNullException("body");
|
||||
}
|
||||
if (parameters.Length > 4)
|
||||
{
|
||||
throw new ArgumentException("Too many parameters");
|
||||
}
|
||||
return Expression.Lambda(Expression.GetDelegateType(body.Type, parameters), body, parameters);
|
||||
}
|
||||
|
||||
// Token: 0x06000082 RID: 130 RVA: 0x000044A4 File Offset: 0x000026A4
|
||||
private static Type GetDelegateType(Type return_type, ParameterExpression[] parameters)
|
||||
{
|
||||
if (parameters == null)
|
||||
{
|
||||
parameters = new ParameterExpression[0];
|
||||
}
|
||||
if (return_type == typeof(void))
|
||||
{
|
||||
return Expression.GetActionType(parameters.Select((ParameterExpression p) => p.Type).ToArray<Type>());
|
||||
}
|
||||
Type[] array = new Type[parameters.Length + 1];
|
||||
for (int i = 0; i < array.Length - 1; i++)
|
||||
{
|
||||
array[i] = parameters[i].Type;
|
||||
}
|
||||
array[array.Length - 1] = return_type;
|
||||
return Expression.GetFuncType(array);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.LambdaExpression" /> and can be used when the delegate type is not known at compile time.</summary>
|
||||
/// <returns>An object that represents a lambda expression which has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Lambda" /> and the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> and <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> properties set to the specified values.</returns>
|
||||
/// <param name="delegateType">A <see cref="T:System.Type" /> that represents a delegate type.</param>
|
||||
/// <param name="body">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> property equal to.</param>
|
||||
/// <param name="parameters">An array of <see cref="T:System.Linq.Expressions.ParameterExpression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="delegateType" /> or <paramref name="body" /> is null.-or-One or more elements in <paramref name="parameters" /> are null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="delegateType" /> does not represent a delegate type.-or-<paramref name="body" />.Type represents a type that is not assignable to the return type of the delegate type represented by <paramref name="delegateType" />.-or-<paramref name="parameters" /> does not contain the same number of elements as the list of parameters for the delegate type represented by <paramref name="delegateType" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="parameters" /> is not assignable from the type of the corresponding parameter type of the delegate type represented by <paramref name="delegateType" />.</exception>
|
||||
// Token: 0x06000083 RID: 131 RVA: 0x00004538 File Offset: 0x00002738
|
||||
public static LambdaExpression Lambda(Type delegateType, Expression body, params ParameterExpression[] parameters)
|
||||
{
|
||||
return Expression.Lambda(delegateType, body, parameters);
|
||||
}
|
||||
|
||||
// Token: 0x06000084 RID: 132 RVA: 0x00004544 File Offset: 0x00002744
|
||||
private static LambdaExpression CreateExpressionOf(Type type, Expression body, ReadOnlyCollection<ParameterExpression> parameters)
|
||||
{
|
||||
return (LambdaExpression)typeof(Expression<>).MakeGenericType(new Type[] { type }).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy, null, new Type[]
|
||||
{
|
||||
typeof(Expression),
|
||||
typeof(ReadOnlyCollection<ParameterExpression>)
|
||||
}, null).Invoke(new object[] { body, parameters });
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.LambdaExpression" /> and can be used when the delegate type is not known at compile time.</summary>
|
||||
/// <returns>An object that represents a lambda expression which has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Lambda" /> and the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> and <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> properties set to the specified values.</returns>
|
||||
/// <param name="delegateType">A <see cref="T:System.Type" /> that represents a delegate type.</param>
|
||||
/// <param name="body">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.LambdaExpression.Body" /> property equal to.</param>
|
||||
/// <param name="parameters">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.ParameterExpression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.LambdaExpression.Parameters" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="delegateType" /> or <paramref name="body" /> is null.-or-One or more elements in <paramref name="parameters" /> are null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="delegateType" /> does not represent a delegate type.-or-<paramref name="body" />.Type represents a type that is not assignable to the return type of the delegate type represented by <paramref name="delegateType" />.-or-<paramref name="parameters" /> does not contain the same number of elements as the list of parameters for the delegate type represented by <paramref name="delegateType" />.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="parameters" /> is not assignable from the type of the corresponding parameter type of the delegate type represented by <paramref name="delegateType" />.</exception>
|
||||
// Token: 0x06000085 RID: 133 RVA: 0x000045AC File Offset: 0x000027AC
|
||||
public static LambdaExpression Lambda(Type delegateType, Expression body, IEnumerable<ParameterExpression> parameters)
|
||||
{
|
||||
if (delegateType == null)
|
||||
{
|
||||
throw new ArgumentNullException("delegateType");
|
||||
}
|
||||
if (body == null)
|
||||
{
|
||||
throw new ArgumentNullException("body");
|
||||
}
|
||||
ReadOnlyCollection<ParameterExpression> readOnlyCollection = parameters.ToReadOnlyCollection<ParameterExpression>();
|
||||
body = Expression.CheckLambda(delegateType, body, readOnlyCollection);
|
||||
return Expression.CreateExpressionOf(delegateType, body, readOnlyCollection);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberListBinding" /> where the member is a field or property.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberListBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.ListBinding" /> and the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> and <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> properties set to the specified values.</returns>
|
||||
/// <param name="member">A <see cref="T:System.Reflection.MemberInfo" /> that represents a field or property to set the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property equal to.</param>
|
||||
/// <param name="initializers">An array of <see cref="T:System.Linq.Expressions.ElementInit" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="member" /> is null. -or-One or more elements of <paramref name="initializers" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="member" /> does not represent a field or property.-or-The <see cref="P:System.Reflection.FieldInfo.FieldType" /> or <see cref="P:System.Reflection.PropertyInfo.PropertyType" /> of the field or property that <paramref name="member" /> represents does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
|
||||
// Token: 0x06000086 RID: 134 RVA: 0x000045F4 File Offset: 0x000027F4
|
||||
public static MemberListBinding ListBind(MemberInfo member, params ElementInit[] initializers)
|
||||
{
|
||||
return Expression.ListBind(member, initializers);
|
||||
}
|
||||
|
||||
// Token: 0x06000087 RID: 135 RVA: 0x00004600 File Offset: 0x00002800
|
||||
private static void CheckIsAssignableToIEnumerable(Type t)
|
||||
{
|
||||
if (!t.IsAssignableTo(typeof(IEnumerable)))
|
||||
{
|
||||
throw new ArgumentException(string.Format("Type {0} doesn't implemen IEnumerable", t));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberListBinding" /> where the member is a field or property.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberListBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.ListBinding" /> and the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> and <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> properties set to the specified values.</returns>
|
||||
/// <param name="member">A <see cref="T:System.Reflection.MemberInfo" /> that represents a field or property to set the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property equal to.</param>
|
||||
/// <param name="initializers">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.ElementInit" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="member" /> is null. -or-One or more elements of <paramref name="initializers" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="member" /> does not represent a field or property.-or-The <see cref="P:System.Reflection.FieldInfo.FieldType" /> or <see cref="P:System.Reflection.PropertyInfo.PropertyType" /> of the field or property that <paramref name="member" /> represents does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
|
||||
// Token: 0x06000088 RID: 136 RVA: 0x00004634 File Offset: 0x00002834
|
||||
public static MemberListBinding ListBind(MemberInfo member, IEnumerable<ElementInit> initializers)
|
||||
{
|
||||
if (member == null)
|
||||
{
|
||||
throw new ArgumentNullException("member");
|
||||
}
|
||||
if (initializers == null)
|
||||
{
|
||||
throw new ArgumentNullException("initializers");
|
||||
}
|
||||
ReadOnlyCollection<ElementInit> readOnlyCollection = initializers.ToReadOnlyCollection<ElementInit>();
|
||||
Expression.CheckForNull<ElementInit>(readOnlyCollection, "initializers");
|
||||
member.OnFieldOrProperty(delegate(FieldInfo field)
|
||||
{
|
||||
Expression.CheckIsAssignableToIEnumerable(field.FieldType);
|
||||
}, delegate(PropertyInfo prop)
|
||||
{
|
||||
Expression.CheckIsAssignableToIEnumerable(prop.PropertyType);
|
||||
});
|
||||
return new MemberListBinding(member, readOnlyCollection);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberListBinding" /> object based on a specified property accessor method.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberListBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.ListBinding" />, the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property set to the <see cref="T:System.Reflection.MemberInfo" /> that represents the property accessed in <paramref name="propertyAccessor" />, and <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> populated with the elements of <paramref name="initializers" />.</returns>
|
||||
/// <param name="propertyAccessor">A <see cref="T:System.Reflection.MethodInfo" /> that represents a property accessor method.</param>
|
||||
/// <param name="initializers">An array of <see cref="T:System.Linq.Expressions.ElementInit" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="propertyAccessor" /> is null. -or-One or more elements of <paramref name="initializers" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="propertyAccessor" /> does not represent a property accessor method.-or-The <see cref="P:System.Reflection.PropertyInfo.PropertyType" /> of the property that the method represented by <paramref name="propertyAccessor" /> accesses does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
|
||||
// Token: 0x06000089 RID: 137 RVA: 0x000046BC File Offset: 0x000028BC
|
||||
public static MemberListBinding ListBind(MethodInfo propertyAccessor, params ElementInit[] initializers)
|
||||
{
|
||||
return Expression.ListBind(propertyAccessor, initializers);
|
||||
}
|
||||
|
||||
// Token: 0x0600008A RID: 138 RVA: 0x000046C8 File Offset: 0x000028C8
|
||||
private static void CheckForNull<T>(ReadOnlyCollection<T> collection, string name) where T : class
|
||||
{
|
||||
foreach (T t in collection)
|
||||
{
|
||||
if (t == null)
|
||||
{
|
||||
throw new ArgumentNullException(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberListBinding" /> based on a specified property accessor method.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberListBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.ListBinding" />, the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property set to the <see cref="T:System.Reflection.MemberInfo" /> that represents the property accessed in <paramref name="propertyAccessor" />, and <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> populated with the elements of <paramref name="initializers" />.</returns>
|
||||
/// <param name="propertyAccessor">A <see cref="T:System.Reflection.MethodInfo" /> that represents a property accessor method.</param>
|
||||
/// <param name="initializers">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.ElementInit" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberListBinding.Initializers" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="propertyAccessor" /> is null. -or-One or more elements of <paramref name="initializers" /> are null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="propertyAccessor" /> does not represent a property accessor method.-or-The <see cref="P:System.Reflection.PropertyInfo.PropertyType" /> of the property that the method represented by <paramref name="propertyAccessor" /> accesses does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
|
||||
// Token: 0x0600008B RID: 139 RVA: 0x00004734 File Offset: 0x00002934
|
||||
public static MemberListBinding ListBind(MethodInfo propertyAccessor, IEnumerable<ElementInit> initializers)
|
||||
{
|
||||
if (propertyAccessor == null)
|
||||
{
|
||||
throw new ArgumentNullException("propertyAccessor");
|
||||
}
|
||||
if (initializers == null)
|
||||
{
|
||||
throw new ArgumentNullException("initializers");
|
||||
}
|
||||
ReadOnlyCollection<ElementInit> readOnlyCollection = initializers.ToReadOnlyCollection<ElementInit>();
|
||||
Expression.CheckForNull<ElementInit>(readOnlyCollection, "initializers");
|
||||
PropertyInfo associatedProperty = Expression.GetAssociatedProperty(propertyAccessor);
|
||||
if (associatedProperty == null)
|
||||
{
|
||||
throw new ArgumentException("propertyAccessor");
|
||||
}
|
||||
Expression.CheckIsAssignableToIEnumerable(associatedProperty.PropertyType);
|
||||
return new MemberListBinding(associatedProperty, readOnlyCollection);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ListInitExpression" /> that uses specified <see cref="T:System.Linq.Expressions.ElementInit" /> objects to initialize a collection.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.ListInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ListInit" /> and the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> and <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> properties set to the specified values.</returns>
|
||||
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property equal to.</param>
|
||||
/// <param name="initializers">An array of <see cref="T:System.Linq.Expressions.ElementInit" /> objects to use to populate the <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="newExpression" /> or <paramref name="initializers" /> is null.-or-One or more elements of <paramref name="initializers" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="newExpression" />.Type does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
|
||||
// Token: 0x0600008C RID: 140 RVA: 0x000047A0 File Offset: 0x000029A0
|
||||
public static ListInitExpression ListInit(NewExpression newExpression, params ElementInit[] initializers)
|
||||
{
|
||||
return Expression.ListInit(newExpression, initializers);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ListInitExpression" /> that uses specified <see cref="T:System.Linq.Expressions.ElementInit" /> objects to initialize a collection.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.ListInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ListInit" /> and the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> and <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> properties set to the specified values.</returns>
|
||||
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property equal to.</param>
|
||||
/// <param name="initializers">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.ElementInit" /> objects to use to populate the <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="newExpression" /> or <paramref name="initializers" /> is null.-or-One or more elements of <paramref name="initializers" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="newExpression" />.Type does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
|
||||
// Token: 0x0600008D RID: 141 RVA: 0x000047AC File Offset: 0x000029AC
|
||||
public static ListInitExpression ListInit(NewExpression newExpression, IEnumerable<ElementInit> initializers)
|
||||
{
|
||||
ReadOnlyCollection<ElementInit> readOnlyCollection = Expression.CheckListInit<ElementInit>(newExpression, initializers);
|
||||
return new ListInitExpression(newExpression, readOnlyCollection);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ListInitExpression" /> that uses a method named "Add" to add elements to a collection.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.ListInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ListInit" /> and the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property set to the specified value.</returns>
|
||||
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property equal to.</param>
|
||||
/// <param name="initializers">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="newExpression" /> or <paramref name="initializers" /> is null.-or-One or more elements of <paramref name="initializers" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="newExpression" />.Type does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">There is no instance method named "Add" (case insensitive) declared in <paramref name="newExpression" />.Type or its base type.-or-The add method on <paramref name="newExpression" />.Type or its base type does not take exactly one argument.-or-The type represented by the <see cref="P:System.Linq.Expressions.Expression.Type" /> property of the first element of <paramref name="initializers" /> is not assignable to the argument type of the add method on <paramref name="newExpression" />.Type or its base type.-or-More than one argument-compatible method named "Add" (case-insensitive) exists on <paramref name="newExpression" />.Type and/or its base type.</exception>
|
||||
// Token: 0x0600008E RID: 142 RVA: 0x000047C8 File Offset: 0x000029C8
|
||||
public static ListInitExpression ListInit(NewExpression newExpression, params Expression[] initializers)
|
||||
{
|
||||
return Expression.ListInit(newExpression, initializers);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ListInitExpression" /> that uses a method named "Add" to add elements to a collection.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.ListInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ListInit" /> and the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property set to the specified value.</returns>
|
||||
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property equal to.</param>
|
||||
/// <param name="initializers">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="newExpression" /> or <paramref name="initializers" /> is null.-or-One or more elements of <paramref name="initializers" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="newExpression" />.Type does not implement <see cref="T:System.Collections.IEnumerable" />.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">There is no instance method named "Add" (case insensitive) declared in <paramref name="newExpression" />.Type or its base type.-or-The add method on <paramref name="newExpression" />.Type or its base type does not take exactly one argument.-or-The type represented by the <see cref="P:System.Linq.Expressions.Expression.Type" /> property of the first element of <paramref name="initializers" /> is not assignable to the argument type of the add method on <paramref name="newExpression" />.Type or its base type.-or-More than one argument-compatible method named "Add" (case-insensitive) exists on <paramref name="newExpression" />.Type and/or its base type.</exception>
|
||||
// Token: 0x0600008F RID: 143 RVA: 0x000047D4 File Offset: 0x000029D4
|
||||
public static ListInitExpression ListInit(NewExpression newExpression, IEnumerable<Expression> initializers)
|
||||
{
|
||||
ReadOnlyCollection<Expression> readOnlyCollection = Expression.CheckListInit<Expression>(newExpression, initializers);
|
||||
MethodInfo addMethod = Expression.GetAddMethod(newExpression.Type, readOnlyCollection[0].Type);
|
||||
if (addMethod == null)
|
||||
{
|
||||
throw new InvalidOperationException("No suitable add method found");
|
||||
}
|
||||
return new ListInitExpression(newExpression, Expression.CreateInitializers(addMethod, readOnlyCollection));
|
||||
}
|
||||
|
||||
// Token: 0x06000090 RID: 144 RVA: 0x00004820 File Offset: 0x00002A20
|
||||
private static ReadOnlyCollection<ElementInit> CreateInitializers(MethodInfo add_method, ReadOnlyCollection<Expression> initializers)
|
||||
{
|
||||
return initializers.Select((Expression init) => Expression.ElementInit(add_method, new Expression[] { init })).ToReadOnlyCollection<ElementInit>();
|
||||
}
|
||||
|
||||
// Token: 0x06000091 RID: 145 RVA: 0x00004854 File Offset: 0x00002A54
|
||||
private static MethodInfo GetAddMethod(Type type, Type arg)
|
||||
{
|
||||
return type.GetMethod("Add", BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy, null, new Type[] { arg }, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ListInitExpression" /> that uses a specified method to add elements to a collection.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.ListInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ListInit" /> and the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property set to the specified value.</returns>
|
||||
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property equal to.</param>
|
||||
/// <param name="addMethod">A <see cref="T:System.Reflection.MethodInfo" /> that represents an instance method that takes one argument, that adds an element to a collection.</param>
|
||||
/// <param name="initializers">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="newExpression" /> or <paramref name="initializers" /> is null.-or-One or more elements of <paramref name="initializers" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="newExpression" />.Type does not implement <see cref="T:System.Collections.IEnumerable" />.-or-<paramref name="addMethod" /> is not null and it does not represent an instance method named "Add" (case insensitive) that takes exactly one argument.-or-<paramref name="addMethod" /> is not null and the type represented by the <see cref="P:System.Linq.Expressions.Expression.Type" /> property of one or more elements of <paramref name="initializers" /> is not assignable to the argument type of the method that <paramref name="addMethod" /> represents.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="addMethod" /> is null and no instance method named "Add" that takes one type-compatible argument exists on <paramref name="newExpression" />.Type or its base type.</exception>
|
||||
// Token: 0x06000092 RID: 146 RVA: 0x00004870 File Offset: 0x00002A70
|
||||
public static ListInitExpression ListInit(NewExpression newExpression, MethodInfo addMethod, params Expression[] initializers)
|
||||
{
|
||||
return Expression.ListInit(newExpression, addMethod, initializers);
|
||||
}
|
||||
|
||||
// Token: 0x06000093 RID: 147 RVA: 0x0000487C File Offset: 0x00002A7C
|
||||
private static ReadOnlyCollection<T> CheckListInit<T>(NewExpression newExpression, IEnumerable<T> initializers) where T : class
|
||||
{
|
||||
if (newExpression == null)
|
||||
{
|
||||
throw new ArgumentNullException("newExpression");
|
||||
}
|
||||
if (initializers == null)
|
||||
{
|
||||
throw new ArgumentNullException("initializers");
|
||||
}
|
||||
if (!newExpression.Type.IsAssignableTo(typeof(IEnumerable)))
|
||||
{
|
||||
throw new InvalidOperationException("The type of the new expression does not implement IEnumerable");
|
||||
}
|
||||
ReadOnlyCollection<T> readOnlyCollection = initializers.ToReadOnlyCollection<T>();
|
||||
if (readOnlyCollection.Count == 0)
|
||||
{
|
||||
throw new ArgumentException("Empty initializers");
|
||||
}
|
||||
Expression.CheckForNull<T>(readOnlyCollection, "initializers");
|
||||
return readOnlyCollection;
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ListInitExpression" /> that uses a specified method to add elements to a collection.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.ListInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.ListInit" /> and the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property set to the specified value.</returns>
|
||||
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.ListInitExpression.NewExpression" /> property equal to.</param>
|
||||
/// <param name="addMethod">A <see cref="T:System.Reflection.MethodInfo" /> that represents an instance method named "Add" (case insensitive), that adds an element to a collection.</param>
|
||||
/// <param name="initializers">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.ListInitExpression.Initializers" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="newExpression" /> or <paramref name="initializers" /> is null.-or-One or more elements of <paramref name="initializers" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="newExpression" />.Type does not implement <see cref="T:System.Collections.IEnumerable" />.-or-<paramref name="addMethod" /> is not null and it does not represent an instance method named "Add" (case insensitive) that takes exactly one argument.-or-<paramref name="addMethod" /> is not null and the type represented by the <see cref="P:System.Linq.Expressions.Expression.Type" /> property of one or more elements of <paramref name="initializers" /> is not assignable to the argument type of the method that <paramref name="addMethod" /> represents.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="addMethod" /> is null and no instance method named "Add" that takes one type-compatible argument exists on <paramref name="newExpression" />.Type or its base type.</exception>
|
||||
// Token: 0x06000094 RID: 148 RVA: 0x000048FC File Offset: 0x00002AFC
|
||||
public static ListInitExpression ListInit(NewExpression newExpression, MethodInfo addMethod, IEnumerable<Expression> initializers)
|
||||
{
|
||||
ReadOnlyCollection<Expression> readOnlyCollection = Expression.CheckListInit<Expression>(newExpression, initializers);
|
||||
if (addMethod != null)
|
||||
{
|
||||
if (addMethod.Name.ToLower(CultureInfo.InvariantCulture) != "add")
|
||||
{
|
||||
throw new ArgumentException("addMethod");
|
||||
}
|
||||
ParameterInfo[] parameters = addMethod.GetParameters();
|
||||
if (parameters.Length != 1)
|
||||
{
|
||||
throw new ArgumentException("addMethod");
|
||||
}
|
||||
foreach (Expression expression in readOnlyCollection)
|
||||
{
|
||||
if (!Expression.IsAssignableToParameterType(expression.Type, parameters[0]))
|
||||
{
|
||||
throw new InvalidOperationException("Initializer not assignable to the add method parameter type");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (addMethod == null)
|
||||
{
|
||||
addMethod = Expression.GetAddMethod(newExpression.Type, readOnlyCollection[0].Type);
|
||||
}
|
||||
if (addMethod == null)
|
||||
{
|
||||
throw new InvalidOperationException("No suitable add method found");
|
||||
}
|
||||
return new ListInitExpression(newExpression, Expression.CreateInitializers(addMethod, readOnlyCollection));
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberExpression" /> that represents accessing either a field or a property.</summary>
|
||||
/// <returns>The <see cref="T:System.Linq.Expressions.MemberExpression" /> that results from calling the appropriate factory method.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the object that the member belongs to.</param>
|
||||
/// <param name="member">The <see cref="T:System.Reflection.MemberInfo" /> that describes the field or property to be accessed.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> or <paramref name="member" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="member" /> does not represent a field or property.</exception>
|
||||
// Token: 0x06000095 RID: 149 RVA: 0x00004A04 File Offset: 0x00002C04
|
||||
public static MemberExpression MakeMemberAccess(Expression expression, MemberInfo member)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
if (member == null)
|
||||
{
|
||||
throw new ArgumentNullException("member");
|
||||
}
|
||||
FieldInfo fieldInfo = member as FieldInfo;
|
||||
if (fieldInfo != null)
|
||||
{
|
||||
return Expression.Field(expression, fieldInfo);
|
||||
}
|
||||
PropertyInfo propertyInfo = member as PropertyInfo;
|
||||
if (propertyInfo != null)
|
||||
{
|
||||
return Expression.Property(expression, propertyInfo);
|
||||
}
|
||||
throw new ArgumentException("Member should either be a field or a property");
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" />, given an operand, by calling the appropriate factory method.</summary>
|
||||
/// <returns>The <see cref="T:System.Linq.Expressions.UnaryExpression" /> that results from calling the appropriate factory method.</returns>
|
||||
/// <param name="unaryType">The <see cref="T:System.Linq.Expressions.ExpressionType" /> that specifies the type of unary operation.</param>
|
||||
/// <param name="operand">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the operand.</param>
|
||||
/// <param name="type">The <see cref="T:System.Type" /> that specifies the type to be converted to (pass null if not applicable).</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="unaryType" /> does not correspond to a unary expression node.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="operand" /> is null.</exception>
|
||||
// Token: 0x06000096 RID: 150 RVA: 0x00004A68 File Offset: 0x00002C68
|
||||
public static UnaryExpression MakeUnary(ExpressionType unaryType, Expression operand, Type type)
|
||||
{
|
||||
return Expression.MakeUnary(unaryType, operand, type, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" />, given an operand and implementing method, by calling the appropriate factory method.</summary>
|
||||
/// <returns>The <see cref="T:System.Linq.Expressions.UnaryExpression" /> that results from calling the appropriate factory method.</returns>
|
||||
/// <param name="unaryType">The <see cref="T:System.Linq.Expressions.ExpressionType" /> that specifies the type of unary operation.</param>
|
||||
/// <param name="operand">An <see cref="T:System.Linq.Expressions.Expression" /> that represents the operand.</param>
|
||||
/// <param name="type">The <see cref="T:System.Type" /> that specifies the type to be converted to (pass null if not applicable).</param>
|
||||
/// <param name="method">The <see cref="T:System.Reflection.MethodInfo" /> that represents the implementing method.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="unaryType" /> does not correspond to a unary expression node.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="operand" /> is null.</exception>
|
||||
// Token: 0x06000097 RID: 151 RVA: 0x00004A74 File Offset: 0x00002C74
|
||||
public static UnaryExpression MakeUnary(ExpressionType unaryType, Expression operand, Type type, MethodInfo method)
|
||||
{
|
||||
switch (unaryType)
|
||||
{
|
||||
case ExpressionType.Negate:
|
||||
return Expression.Negate(operand, method);
|
||||
case ExpressionType.UnaryPlus:
|
||||
return Expression.UnaryPlus(operand, method);
|
||||
case ExpressionType.NegateChecked:
|
||||
return Expression.NegateChecked(operand, method);
|
||||
default:
|
||||
if (unaryType == ExpressionType.Convert)
|
||||
{
|
||||
return Expression.Convert(operand, type, method);
|
||||
}
|
||||
if (unaryType == ExpressionType.ConvertChecked)
|
||||
{
|
||||
return Expression.ConvertChecked(operand, type, method);
|
||||
}
|
||||
if (unaryType == ExpressionType.ArrayLength)
|
||||
{
|
||||
return Expression.ArrayLength(operand);
|
||||
}
|
||||
if (unaryType == ExpressionType.Quote)
|
||||
{
|
||||
return Expression.Quote(operand);
|
||||
}
|
||||
if (unaryType != ExpressionType.TypeAs)
|
||||
{
|
||||
throw new ArgumentException("MakeUnary expect an unary operator");
|
||||
}
|
||||
return Expression.TypeAs(operand, type);
|
||||
case ExpressionType.Not:
|
||||
return Expression.Not(operand, method);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that represents the recursive initialization of members of a field or property.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.MemberBinding" /> and the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> and <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> properties set to the specified values.</returns>
|
||||
/// <param name="member">The <see cref="T:System.Reflection.MemberInfo" /> to set the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property equal to.</param>
|
||||
/// <param name="bindings">An array of <see cref="T:System.Linq.Expressions.MemberBinding" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="member" /> or <paramref name="bindings" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="member" /> does not represent a field or property.-or-The <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property of an element of <paramref name="bindings" /> does not represent a member of the type of the field or property that <paramref name="member" /> represents.</exception>
|
||||
// Token: 0x06000098 RID: 152 RVA: 0x00004B28 File Offset: 0x00002D28
|
||||
public static MemberMemberBinding MemberBind(MemberInfo member, params MemberBinding[] bindings)
|
||||
{
|
||||
return Expression.MemberBind(member, bindings);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that represents the recursive initialization of members of a field or property.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.MemberBinding" /> and the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> and <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> properties set to the specified values.</returns>
|
||||
/// <param name="member">The <see cref="T:System.Reflection.MemberInfo" /> to set the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property equal to.</param>
|
||||
/// <param name="bindings">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.MemberBinding" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="member" /> or <paramref name="bindings" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="member" /> does not represent a field or property.-or-The <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property of an element of <paramref name="bindings" /> does not represent a member of the type of the field or property that <paramref name="member" /> represents.</exception>
|
||||
// Token: 0x06000099 RID: 153 RVA: 0x00004B34 File Offset: 0x00002D34
|
||||
public static MemberMemberBinding MemberBind(MemberInfo member, IEnumerable<MemberBinding> bindings)
|
||||
{
|
||||
if (member == null)
|
||||
{
|
||||
throw new ArgumentNullException("member");
|
||||
}
|
||||
Type type = member.OnFieldOrProperty((FieldInfo field) => field.FieldType, (PropertyInfo prop) => prop.PropertyType);
|
||||
return new MemberMemberBinding(member, Expression.CheckMemberBindings(type, bindings));
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that represents the recursive initialization of members of a member that is accessed by using a property accessor method.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.MemberBinding" />, the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property set to the <see cref="T:System.Reflection.PropertyInfo" /> that represents the property accessed in <paramref name="propertyAccessor" />, and <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> properties set to the specified values.</returns>
|
||||
/// <param name="propertyAccessor">The <see cref="T:System.Reflection.MethodInfo" /> that represents a property accessor method.</param>
|
||||
/// <param name="bindings">An array of <see cref="T:System.Linq.Expressions.MemberBinding" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="propertyAccessor" /> or <paramref name="bindings" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="propertyAccessor" /> does not represent a property accessor method.-or-The <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property of an element of <paramref name="bindings" /> does not represent a member of the type of the property accessed by the method that <paramref name="propertyAccessor" /> represents.</exception>
|
||||
// Token: 0x0600009A RID: 154 RVA: 0x00004BA0 File Offset: 0x00002DA0
|
||||
public static MemberMemberBinding MemberBind(MethodInfo propertyAccessor, params MemberBinding[] bindings)
|
||||
{
|
||||
return Expression.MemberBind(propertyAccessor, bindings);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that represents the recursive initialization of members of a member that is accessed by using a property accessor method.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberMemberBinding" /> that has the <see cref="P:System.Linq.Expressions.MemberBinding.BindingType" /> property equal to <see cref="F:System.Linq.Expressions.MemberBindingType.MemberBinding" />, the <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property set to the <see cref="T:System.Reflection.PropertyInfo" /> that represents the property accessed in <paramref name="propertyAccessor" />, and <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> properties set to the specified values.</returns>
|
||||
/// <param name="propertyAccessor">The <see cref="T:System.Reflection.MethodInfo" /> that represents a property accessor method.</param>
|
||||
/// <param name="bindings">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.MemberBinding" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberMemberBinding.Bindings" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="propertyAccessor" /> or <paramref name="bindings" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="propertyAccessor" /> does not represent a property accessor method.-or-The <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property of an element of <paramref name="bindings" /> does not represent a member of the type of the property accessed by the method that <paramref name="propertyAccessor" /> represents.</exception>
|
||||
// Token: 0x0600009B RID: 155 RVA: 0x00004BAC File Offset: 0x00002DAC
|
||||
public static MemberMemberBinding MemberBind(MethodInfo propertyAccessor, IEnumerable<MemberBinding> bindings)
|
||||
{
|
||||
if (propertyAccessor == null)
|
||||
{
|
||||
throw new ArgumentNullException("propertyAccessor");
|
||||
}
|
||||
ReadOnlyCollection<MemberBinding> readOnlyCollection = bindings.ToReadOnlyCollection<MemberBinding>();
|
||||
Expression.CheckForNull<MemberBinding>(readOnlyCollection, "bindings");
|
||||
PropertyInfo associatedProperty = Expression.GetAssociatedProperty(propertyAccessor);
|
||||
if (associatedProperty == null)
|
||||
{
|
||||
throw new ArgumentException("propertyAccessor");
|
||||
}
|
||||
return new MemberMemberBinding(associatedProperty, Expression.CheckMemberBindings(associatedProperty.PropertyType, bindings));
|
||||
}
|
||||
|
||||
// Token: 0x0600009C RID: 156 RVA: 0x00004C08 File Offset: 0x00002E08
|
||||
private static ReadOnlyCollection<MemberBinding> CheckMemberBindings(Type type, IEnumerable<MemberBinding> bindings)
|
||||
{
|
||||
if (bindings == null)
|
||||
{
|
||||
throw new ArgumentNullException("bindings");
|
||||
}
|
||||
ReadOnlyCollection<MemberBinding> readOnlyCollection = bindings.ToReadOnlyCollection<MemberBinding>();
|
||||
Expression.CheckForNull<MemberBinding>(readOnlyCollection, "bindings");
|
||||
foreach (MemberBinding memberBinding in readOnlyCollection)
|
||||
{
|
||||
if (!type.IsAssignableTo(memberBinding.Member.DeclaringType))
|
||||
{
|
||||
throw new ArgumentException("Type not assignable to member type");
|
||||
}
|
||||
}
|
||||
return readOnlyCollection;
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberInitExpression" />.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberInit" /> and the <see cref="P:System.Linq.Expressions.MemberInitExpression.NewExpression" /> and <see cref="P:System.Linq.Expressions.MemberInitExpression.Bindings" /> properties set to the specified values.</returns>
|
||||
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.MemberInitExpression.NewExpression" /> property equal to.</param>
|
||||
/// <param name="bindings">An array of <see cref="T:System.Linq.Expressions.MemberBinding" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberInitExpression.Bindings" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="newExpression" /> or <paramref name="bindings" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property of an element of <paramref name="bindings" /> does not represent a member of the type that <paramref name="newExpression" />.Type represents.</exception>
|
||||
// Token: 0x0600009D RID: 157 RVA: 0x00004CA4 File Offset: 0x00002EA4
|
||||
public static MemberInitExpression MemberInit(NewExpression newExpression, params MemberBinding[] bindings)
|
||||
{
|
||||
return Expression.MemberInit(newExpression, bindings);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberInitExpression" />.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberInitExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberInit" /> and the <see cref="P:System.Linq.Expressions.MemberInitExpression.NewExpression" /> and <see cref="P:System.Linq.Expressions.MemberInitExpression.Bindings" /> properties set to the specified values.</returns>
|
||||
/// <param name="newExpression">A <see cref="T:System.Linq.Expressions.NewExpression" /> to set the <see cref="P:System.Linq.Expressions.MemberInitExpression.NewExpression" /> property equal to.</param>
|
||||
/// <param name="bindings">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.MemberBinding" /> objects to use to populate the <see cref="P:System.Linq.Expressions.MemberInitExpression.Bindings" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="newExpression" /> or <paramref name="bindings" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The <see cref="P:System.Linq.Expressions.MemberBinding.Member" /> property of an element of <paramref name="bindings" /> does not represent a member of the type that <paramref name="newExpression" />.Type represents.</exception>
|
||||
// Token: 0x0600009E RID: 158 RVA: 0x00004CB0 File Offset: 0x00002EB0
|
||||
public static MemberInitExpression MemberInit(NewExpression newExpression, IEnumerable<MemberBinding> bindings)
|
||||
{
|
||||
if (newExpression == null)
|
||||
{
|
||||
throw new ArgumentNullException("newExpression");
|
||||
}
|
||||
return new MemberInitExpression(newExpression, Expression.CheckMemberBindings(newExpression.Type, bindings));
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents an arithmetic negation operation.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Negate" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property set to the specified value.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The unary minus operator is not defined for <paramref name="expression" />.Type.</exception>
|
||||
// Token: 0x0600009F RID: 159 RVA: 0x00004CD8 File Offset: 0x00002ED8
|
||||
public static UnaryExpression Negate(Expression expression)
|
||||
{
|
||||
return Expression.Negate(expression, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents an arithmetic negation operation. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Negate" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> and <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the unary minus operator is not defined for <paramref name="expression" />.Type.-or-<paramref name="expression" />.Type (or its corresponding non-nullable type if it is a nullable value type) is not assignable to the argument type of the method represented by <paramref name="method" />.</exception>
|
||||
// Token: 0x060000A0 RID: 160 RVA: 0x00004CE4 File Offset: 0x00002EE4
|
||||
public static UnaryExpression Negate(Expression expression, MethodInfo method)
|
||||
{
|
||||
method = Expression.UnaryCoreCheck("op_UnaryNegation", expression, method, (Type type) => Expression.IsSignedNumber(type));
|
||||
return Expression.MakeSimpleUnary(ExpressionType.Negate, expression, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents an arithmetic negation operation that has overflow checking.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NegateChecked" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property set to the specified value.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The unary minus operator is not defined for <paramref name="expression" />.Type.</exception>
|
||||
// Token: 0x060000A1 RID: 161 RVA: 0x00004D28 File Offset: 0x00002F28
|
||||
public static UnaryExpression NegateChecked(Expression expression)
|
||||
{
|
||||
return Expression.NegateChecked(expression, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents an arithmetic negation operation that has overflow checking. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NegateChecked" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> and <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the unary minus operator is not defined for <paramref name="expression" />.Type.-or-<paramref name="expression" />.Type (or its corresponding non-nullable type if it is a nullable value type) is not assignable to the argument type of the method represented by <paramref name="method" />.</exception>
|
||||
// Token: 0x060000A2 RID: 162 RVA: 0x00004D34 File Offset: 0x00002F34
|
||||
public static UnaryExpression NegateChecked(Expression expression, MethodInfo method)
|
||||
{
|
||||
method = Expression.UnaryCoreCheck("op_UnaryNegation", expression, method, (Type type) => Expression.IsSignedNumber(type));
|
||||
return Expression.MakeSimpleUnary(ExpressionType.NegateChecked, expression, method);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewExpression" /> that represents calling the specified constructor that takes no arguments.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.New" /> and the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> property set to the specified value.</returns>
|
||||
/// <param name="constructor">The <see cref="T:System.Reflection.ConstructorInfo" /> to set the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="constructor" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The constructor that <paramref name="constructor" /> represents has at least one parameter.</exception>
|
||||
// Token: 0x060000A3 RID: 163 RVA: 0x00004D78 File Offset: 0x00002F78
|
||||
public static NewExpression New(ConstructorInfo constructor)
|
||||
{
|
||||
if (constructor == null)
|
||||
{
|
||||
throw new ArgumentNullException("constructor");
|
||||
}
|
||||
if (constructor.GetParameters().Length > 0)
|
||||
{
|
||||
throw new ArgumentException("Constructor must be parameter less");
|
||||
}
|
||||
return new NewExpression(constructor, Enumerable.ToReadOnlyCollection((IEnumerable<TSource>)null), null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewExpression" /> that represents calling the parameterless constructor of the specified type.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.New" /> and the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> property set to the <see cref="T:System.Reflection.ConstructorInfo" /> that represents the parameterless constructor of the specified type.</returns>
|
||||
/// <param name="type">A <see cref="T:System.Type" /> that has a constructor that takes no arguments.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="type" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The type that <paramref name="type" /> represents does not have a parameterless constructor.</exception>
|
||||
// Token: 0x060000A4 RID: 164 RVA: 0x00004DB4 File Offset: 0x00002FB4
|
||||
public static NewExpression New(Type type)
|
||||
{
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentNullException("type");
|
||||
}
|
||||
Expression.CheckNotVoid(type);
|
||||
ReadOnlyCollection<Expression> readOnlyCollection = Enumerable.ToReadOnlyCollection((IEnumerable<TSource>)null);
|
||||
if (type.IsValueType)
|
||||
{
|
||||
return new NewExpression(type, readOnlyCollection);
|
||||
}
|
||||
ConstructorInfo constructor = type.GetConstructor(Type.EmptyTypes);
|
||||
if (constructor == null)
|
||||
{
|
||||
throw new ArgumentException("Type doesn't have a parameter less constructor");
|
||||
}
|
||||
return new NewExpression(constructor, readOnlyCollection, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewExpression" /> that represents calling the specified constructor with the specified arguments.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.New" /> and the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> and <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> properties set to the specified values.</returns>
|
||||
/// <param name="constructor">The <see cref="T:System.Reflection.ConstructorInfo" /> to set the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> property equal to.</param>
|
||||
/// <param name="arguments">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="constructor" /> is null.-or-An element of <paramref name="arguments" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The length of <paramref name="arguments" /> does match the number of parameters for the constructor that <paramref name="constructor" /> represents.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the constructor that <paramref name="constructor" /> represents.</exception>
|
||||
// Token: 0x060000A5 RID: 165 RVA: 0x00004E18 File Offset: 0x00003018
|
||||
public static NewExpression New(ConstructorInfo constructor, params Expression[] arguments)
|
||||
{
|
||||
return Expression.New(constructor, arguments);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewExpression" /> that represents calling the specified constructor with the specified arguments.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.New" /> and the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> and <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> properties set to the specified values.</returns>
|
||||
/// <param name="constructor">The <see cref="T:System.Reflection.ConstructorInfo" /> to set the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> property equal to.</param>
|
||||
/// <param name="arguments">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="constructor" /> is null.-or-An element of <paramref name="arguments" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="arguments" /> parameter does not contain the same number of elements as the number of parameters for the constructor that <paramref name="constructor" /> represents.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the constructor that <paramref name="constructor" /> represents.</exception>
|
||||
// Token: 0x060000A6 RID: 166 RVA: 0x00004E24 File Offset: 0x00003024
|
||||
public static NewExpression New(ConstructorInfo constructor, IEnumerable<Expression> arguments)
|
||||
{
|
||||
if (constructor == null)
|
||||
{
|
||||
throw new ArgumentNullException("constructor");
|
||||
}
|
||||
ReadOnlyCollection<Expression> readOnlyCollection = Expression.CheckMethodArguments(constructor, arguments);
|
||||
return new NewExpression(constructor, readOnlyCollection, null);
|
||||
}
|
||||
|
||||
// Token: 0x060000A7 RID: 167 RVA: 0x00004E54 File Offset: 0x00003054
|
||||
private static IList<Expression> CreateArgumentList(IEnumerable<Expression> arguments)
|
||||
{
|
||||
if (arguments == null)
|
||||
{
|
||||
return arguments.ToReadOnlyCollection<Expression>();
|
||||
}
|
||||
return arguments.ToList<Expression>();
|
||||
}
|
||||
|
||||
// Token: 0x060000A8 RID: 168 RVA: 0x00004E6C File Offset: 0x0000306C
|
||||
private static void CheckNonGenericMethod(MethodBase method)
|
||||
{
|
||||
if (method.IsGenericMethodDefinition || method.ContainsGenericParameters)
|
||||
{
|
||||
throw new ArgumentException("Can not used open generic methods");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060000A9 RID: 169 RVA: 0x00004E90 File Offset: 0x00003090
|
||||
private static ReadOnlyCollection<Expression> CheckMethodArguments(MethodBase method, IEnumerable<Expression> args)
|
||||
{
|
||||
Expression.CheckNonGenericMethod(method);
|
||||
IList<Expression> list = Expression.CreateArgumentList(args);
|
||||
ParameterInfo[] parameters = method.GetParameters();
|
||||
if (list.Count != parameters.Length)
|
||||
{
|
||||
throw new ArgumentException("The number of arguments doesn't match the number of parameters");
|
||||
}
|
||||
for (int i = 0; i < parameters.Length; i++)
|
||||
{
|
||||
if (list[i] == null)
|
||||
{
|
||||
throw new ArgumentNullException("arguments");
|
||||
}
|
||||
if (!Expression.IsAssignableToParameterType(list[i].Type, parameters[i]))
|
||||
{
|
||||
if (!parameters[i].ParameterType.IsExpression())
|
||||
{
|
||||
throw new ArgumentException("arguments");
|
||||
}
|
||||
list[i] = Expression.Quote(list[i]);
|
||||
}
|
||||
}
|
||||
return list.ToReadOnlyCollection<Expression>();
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewExpression" /> that represents calling the specified constructor with the specified arguments. The members that access the constructor initialized fields are specified as an array.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.New" /> and the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" />, <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> and <see cref="P:System.Linq.Expressions.NewExpression.Members" /> properties set to the specified values.</returns>
|
||||
/// <param name="constructor">The <see cref="T:System.Reflection.ConstructorInfo" /> to set the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> property equal to.</param>
|
||||
/// <param name="arguments">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> collection.</param>
|
||||
/// <param name="members">An array of <see cref="T:System.Reflection.MemberInfo" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewExpression.Members" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="constructor" /> is null.-or-An element of <paramref name="arguments" /> is null.-or-An element of <paramref name="members" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="arguments" /> parameter does not contain the same number of elements as the number of parameters for the constructor that <paramref name="constructor" /> represents.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the constructor that <paramref name="constructor" /> represents.-or-The <paramref name="members" /> parameter does not have the same number of elements as <paramref name="arguments" />.-or-An element of <paramref name="arguments" /> has a <see cref="P:System.Linq.Expressions.Expression.Type" /> property that represents a type that is not assignable to the type of the member that is represented by the corresponding element of <paramref name="members" />.-or-An element of <paramref name="members" /> represents a property that does not have a get accessor.</exception>
|
||||
// Token: 0x060000AA RID: 170 RVA: 0x00004F44 File Offset: 0x00003144
|
||||
public static NewExpression New(ConstructorInfo constructor, IEnumerable<Expression> arguments, params MemberInfo[] members)
|
||||
{
|
||||
return Expression.New(constructor, arguments, members);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewExpression" /> that represents calling the specified constructor with the specified arguments. The members that access the constructor initialized fields are specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.New" /> and the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" />, <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> and <see cref="P:System.Linq.Expressions.NewExpression.Members" /> properties set to the specified values.</returns>
|
||||
/// <param name="constructor">The <see cref="T:System.Reflection.ConstructorInfo" /> to set the <see cref="P:System.Linq.Expressions.NewExpression.Constructor" /> property equal to.</param>
|
||||
/// <param name="arguments">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewExpression.Arguments" /> collection.</param>
|
||||
/// <param name="members">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Reflection.MemberInfo" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewExpression.Members" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="constructor" /> is null.-or-An element of <paramref name="arguments" /> is null.-or-An element of <paramref name="members" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="arguments" /> parameter does not contain the same number of elements as the number of parameters for the constructor that <paramref name="constructor" /> represents.-or-The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="arguments" /> is not assignable to the type of the corresponding parameter of the constructor that <paramref name="constructor" /> represents.-or-The <paramref name="members" /> parameter does not have the same number of elements as <paramref name="arguments" />.-or-An element of <paramref name="arguments" /> has a <see cref="P:System.Linq.Expressions.Expression.Type" /> property that represents a type that is not assignable to the type of the member that is represented by the corresponding element of <paramref name="members" />.-or-An element of members represents a property that does not have a get accessor.</exception>
|
||||
// Token: 0x060000AB RID: 171 RVA: 0x00004F50 File Offset: 0x00003150
|
||||
public static NewExpression New(ConstructorInfo constructor, IEnumerable<Expression> arguments, IEnumerable<MemberInfo> members)
|
||||
{
|
||||
if (constructor == null)
|
||||
{
|
||||
throw new ArgumentNullException("constructor");
|
||||
}
|
||||
ReadOnlyCollection<Expression> readOnlyCollection = arguments.ToReadOnlyCollection<Expression>();
|
||||
ReadOnlyCollection<MemberInfo> readOnlyCollection2 = members.ToReadOnlyCollection<MemberInfo>();
|
||||
Expression.CheckForNull<Expression>(readOnlyCollection, "arguments");
|
||||
Expression.CheckForNull<MemberInfo>(readOnlyCollection2, "members");
|
||||
readOnlyCollection = Expression.CheckMethodArguments(constructor, arguments);
|
||||
if (readOnlyCollection.Count != readOnlyCollection2.Count)
|
||||
{
|
||||
throw new ArgumentException("Arguments count does not match members count");
|
||||
}
|
||||
for (int i = 0; i < readOnlyCollection2.Count; i++)
|
||||
{
|
||||
MemberInfo memberInfo = readOnlyCollection2[i];
|
||||
MemberTypes memberType = memberInfo.MemberType;
|
||||
Type type;
|
||||
if (memberType != MemberTypes.Field)
|
||||
{
|
||||
if (memberType != MemberTypes.Method)
|
||||
{
|
||||
if (memberType != MemberTypes.Property)
|
||||
{
|
||||
throw new ArgumentException("Member type not allowed");
|
||||
}
|
||||
PropertyInfo propertyInfo = memberInfo as PropertyInfo;
|
||||
if (propertyInfo.GetGetMethod(true) == null)
|
||||
{
|
||||
throw new ArgumentException("Property must have a getter");
|
||||
}
|
||||
type = (memberInfo as PropertyInfo).PropertyType;
|
||||
}
|
||||
else
|
||||
{
|
||||
type = (memberInfo as MethodInfo).ReturnType;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
type = (memberInfo as FieldInfo).FieldType;
|
||||
}
|
||||
if (!readOnlyCollection[i].Type.IsAssignableTo(type))
|
||||
{
|
||||
throw new ArgumentException("Argument type not assignable to member type");
|
||||
}
|
||||
}
|
||||
return new NewExpression(constructor, readOnlyCollection, readOnlyCollection2);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that represents creating an array that has a specified rank.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NewArrayBounds" /> and the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> property set to the specified value.</returns>
|
||||
/// <param name="type">A <see cref="T:System.Type" /> that represents the element type of the array.</param>
|
||||
/// <param name="bounds">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="type" /> or <paramref name="bounds" /> is null.-or-An element of <paramref name="bounds" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="bounds" /> does not represent an integral type.</exception>
|
||||
// Token: 0x060000AC RID: 172 RVA: 0x0000508C File Offset: 0x0000328C
|
||||
public static NewArrayExpression NewArrayBounds(Type type, params Expression[] bounds)
|
||||
{
|
||||
return Expression.NewArrayBounds(type, bounds);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that represents creating an array that has a specified rank.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NewArrayBounds" /> and the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> property set to the specified value.</returns>
|
||||
/// <param name="type">A <see cref="T:System.Type" /> that represents the element type of the array.</param>
|
||||
/// <param name="bounds">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="type" /> or <paramref name="bounds" /> is null.-or-An element of <paramref name="bounds" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="bounds" /> does not represent an integral type.</exception>
|
||||
// Token: 0x060000AD RID: 173 RVA: 0x00005098 File Offset: 0x00003298
|
||||
public static NewArrayExpression NewArrayBounds(Type type, IEnumerable<Expression> bounds)
|
||||
{
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentNullException("type");
|
||||
}
|
||||
if (bounds == null)
|
||||
{
|
||||
throw new ArgumentNullException("bounds");
|
||||
}
|
||||
Expression.CheckNotVoid(type);
|
||||
ReadOnlyCollection<Expression> readOnlyCollection = bounds.ToReadOnlyCollection<Expression>();
|
||||
foreach (Expression expression in readOnlyCollection)
|
||||
{
|
||||
if (!Expression.IsInt(expression.Type))
|
||||
{
|
||||
throw new ArgumentException("The bounds collection can only contain expression of integers types");
|
||||
}
|
||||
}
|
||||
return new NewArrayExpression(ExpressionType.NewArrayBounds, type.MakeArrayType(readOnlyCollection.Count), readOnlyCollection);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that represents creating a one-dimensional array and initializing it from a list of elements.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NewArrayInit" /> and the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> property set to the specified value.</returns>
|
||||
/// <param name="type">A <see cref="T:System.Type" /> that represents the element type of the array.</param>
|
||||
/// <param name="initializers">An array of <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="type" /> or <paramref name="initializers" /> is null.-or-An element of <paramref name="initializers" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="initializers" /> represents a type that is not assignable to the type <paramref name="type" />.</exception>
|
||||
// Token: 0x060000AE RID: 174 RVA: 0x00005150 File Offset: 0x00003350
|
||||
public static NewArrayExpression NewArrayInit(Type type, params Expression[] initializers)
|
||||
{
|
||||
return Expression.NewArrayInit(type, initializers);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that represents creating a one-dimensional array and initializing it from a list of elements.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.NewArrayExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.NewArrayInit" /> and the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> property set to the specified value.</returns>
|
||||
/// <param name="type">A <see cref="T:System.Type" /> that represents the element type of the array.</param>
|
||||
/// <param name="initializers">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains <see cref="T:System.Linq.Expressions.Expression" /> objects to use to populate the <see cref="P:System.Linq.Expressions.NewArrayExpression.Expressions" /> collection.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="type" /> or <paramref name="initializers" /> is null.-or-An element of <paramref name="initializers" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.Linq.Expressions.Expression.Type" /> property of an element of <paramref name="initializers" /> represents a type that is not assignable to the type that <paramref name="type" /> represents.</exception>
|
||||
// Token: 0x060000AF RID: 175 RVA: 0x0000515C File Offset: 0x0000335C
|
||||
public static NewArrayExpression NewArrayInit(Type type, IEnumerable<Expression> initializers)
|
||||
{
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentNullException("type");
|
||||
}
|
||||
if (initializers == null)
|
||||
{
|
||||
throw new ArgumentNullException("initializers");
|
||||
}
|
||||
Expression.CheckNotVoid(type);
|
||||
ReadOnlyCollection<Expression> readOnlyCollection = initializers.ToReadOnlyCollection<Expression>();
|
||||
foreach (Expression expression in readOnlyCollection)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("initializers");
|
||||
}
|
||||
if (!expression.Type.IsAssignableTo(type))
|
||||
{
|
||||
throw new InvalidOperationException(string.Format("{0} IsAssignableTo {1}, expression [ {2} ] : {3}", new object[] { expression.Type, type, expression.NodeType, expression }));
|
||||
}
|
||||
}
|
||||
return new NewArrayExpression(ExpressionType.NewArrayInit, type.MakeArrayType(), readOnlyCollection);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a bitwise complement operation.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Not" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property set to the specified value.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The unary not operator is not defined for <paramref name="expression" />.Type.</exception>
|
||||
// Token: 0x060000B0 RID: 176 RVA: 0x00005248 File Offset: 0x00003448
|
||||
public static UnaryExpression Not(Expression expression)
|
||||
{
|
||||
return Expression.Not(expression, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a bitwise complement operation. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Not" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> and <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the unary not operator is not defined for <paramref name="expression" />.Type.-or-<paramref name="expression" />.Type (or its corresponding non-nullable type if it is a nullable value type) is not assignable to the argument type of the method represented by <paramref name="method" />.</exception>
|
||||
// Token: 0x060000B1 RID: 177 RVA: 0x00005254 File Offset: 0x00003454
|
||||
public static UnaryExpression Not(Expression expression, MethodInfo method)
|
||||
{
|
||||
Func<Type, bool> func = (Type type) => Expression.IsIntOrBool(type);
|
||||
method = Expression.UnaryCoreCheck("op_LogicalNot", expression, method, func);
|
||||
if (method == null)
|
||||
{
|
||||
method = Expression.UnaryCoreCheck("op_OnesComplement", expression, method, func);
|
||||
}
|
||||
return Expression.MakeSimpleUnary(ExpressionType.Not, expression, method);
|
||||
}
|
||||
|
||||
// Token: 0x060000B2 RID: 178 RVA: 0x000052AC File Offset: 0x000034AC
|
||||
private static void CheckNotVoid(Type type)
|
||||
{
|
||||
if (type == typeof(void))
|
||||
{
|
||||
throw new ArgumentException("Type can't be void");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.ParameterExpression" />.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.ParameterExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Parameter" /> and the <see cref="P:System.Linq.Expressions.Expression.Type" /> and <see cref="P:System.Linq.Expressions.ParameterExpression.Name" /> properties set to the specified values.</returns>
|
||||
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.Expression.Type" /> property equal to.</param>
|
||||
/// <param name="name">The value to set the <see cref="P:System.Linq.Expressions.ParameterExpression.Name" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="type" /> is null.</exception>
|
||||
// Token: 0x060000B3 RID: 179 RVA: 0x000052CC File Offset: 0x000034CC
|
||||
public static ParameterExpression Parameter(Type type, string name)
|
||||
{
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentNullException("type");
|
||||
}
|
||||
Expression.CheckNotVoid(type);
|
||||
return new ParameterExpression(type, name);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberExpression" /> that represents accessing a property by using a property accessor method.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberAccess" />, the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> property set to <paramref name="expression" /> and the <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> property set to the <see cref="T:System.Reflection.PropertyInfo" /> that represents the property accessed in <paramref name="propertyAccessor" />.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> property equal to.</param>
|
||||
/// <param name="propertyAccessor">The <see cref="T:System.Reflection.MethodInfo" /> that represents a property accessor method.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="propertyAccessor" /> is null.-or-The method that <paramref name="propertyAccessor" /> represents is not static (Shared in Visual Basic) and <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="expression" />.Type is not assignable to the declaring type of the method represented by <paramref name="propertyAccessor" />.-or-The method that <paramref name="propertyAccessor" /> represents is not a property accessor method.</exception>
|
||||
// Token: 0x060000B4 RID: 180 RVA: 0x000052EC File Offset: 0x000034EC
|
||||
public static MemberExpression Property(Expression expression, MethodInfo propertyAccessor)
|
||||
{
|
||||
if (propertyAccessor == null)
|
||||
{
|
||||
throw new ArgumentNullException("propertyAccessor");
|
||||
}
|
||||
Expression.CheckNonGenericMethod(propertyAccessor);
|
||||
if (!propertyAccessor.IsStatic)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
if (!expression.Type.IsAssignableTo(propertyAccessor.DeclaringType))
|
||||
{
|
||||
throw new ArgumentException("expression");
|
||||
}
|
||||
}
|
||||
PropertyInfo associatedProperty = Expression.GetAssociatedProperty(propertyAccessor);
|
||||
if (associatedProperty == null)
|
||||
{
|
||||
throw new ArgumentException(string.Format("Method {0} has no associated property", propertyAccessor));
|
||||
}
|
||||
return new MemberExpression(expression, associatedProperty, associatedProperty.PropertyType);
|
||||
}
|
||||
|
||||
// Token: 0x060000B5 RID: 181 RVA: 0x00005378 File Offset: 0x00003578
|
||||
private static PropertyInfo GetAssociatedProperty(MethodInfo method)
|
||||
{
|
||||
if (method == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
foreach (PropertyInfo propertyInfo in method.DeclaringType.GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy))
|
||||
{
|
||||
if (method.Equals(propertyInfo.GetGetMethod(true)))
|
||||
{
|
||||
return propertyInfo;
|
||||
}
|
||||
if (method.Equals(propertyInfo.GetSetMethod(true)))
|
||||
{
|
||||
return propertyInfo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberExpression" /> that represents accessing a property.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberAccess" /> and the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> and <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> properties set to the specified values.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> property equal to.</param>
|
||||
/// <param name="property">The <see cref="T:System.Reflection.PropertyInfo" /> to set the <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="property" /> is null.-or-The property that <paramref name="property" /> represents is not static (Shared in Visual Basic) and <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="expression" />.Type is not assignable to the declaring type of the property that <paramref name="property" /> represents.</exception>
|
||||
// Token: 0x060000B6 RID: 182 RVA: 0x000053DC File Offset: 0x000035DC
|
||||
public static MemberExpression Property(Expression expression, PropertyInfo property)
|
||||
{
|
||||
if (property == null)
|
||||
{
|
||||
throw new ArgumentNullException("property");
|
||||
}
|
||||
MethodInfo getMethod = property.GetGetMethod(true);
|
||||
if (getMethod == null)
|
||||
{
|
||||
throw new ArgumentException("getter");
|
||||
}
|
||||
if (!getMethod.IsStatic)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
if (!expression.Type.IsAssignableTo(property.DeclaringType))
|
||||
{
|
||||
throw new ArgumentException("expression");
|
||||
}
|
||||
}
|
||||
else if (expression != null)
|
||||
{
|
||||
throw new ArgumentException("expression");
|
||||
}
|
||||
return new MemberExpression(expression, property, property.PropertyType);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberExpression" /> that represents accessing a property given the name of the property.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberAccess" />, the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> property set to <paramref name="expression" />, and the <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> property set to the <see cref="T:System.Reflection.PropertyInfo" /> that represents the property denoted by <paramref name="propertyName" />.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> whose <see cref="P:System.Linq.Expressions.Expression.Type" /> contains a property named <paramref name="propertyName" />.</param>
|
||||
/// <param name="propertyName">The name of a property.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> or <paramref name="propertyName" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">No property named <paramref name="propertyName" /> is defined in <paramref name="expression" />.Type or its base types.</exception>
|
||||
// Token: 0x060000B7 RID: 183 RVA: 0x00005474 File Offset: 0x00003674
|
||||
public static MemberExpression Property(Expression expression, string propertyName)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
PropertyInfo property = expression.Type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
|
||||
if (property == null)
|
||||
{
|
||||
throw new ArgumentException(string.Format("No property named {0} on {1}", propertyName, expression.Type));
|
||||
}
|
||||
return new MemberExpression(expression, property, property.PropertyType);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.MemberExpression" /> that represents accessing a property or field given the name of the property or field.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.MemberExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.MemberAccess" />, the <see cref="P:System.Linq.Expressions.MemberExpression.Expression" /> property set to <paramref name="expression" />, and the <see cref="P:System.Linq.Expressions.MemberExpression.Member" /> property set to the <see cref="T:System.Reflection.PropertyInfo" /> or <see cref="T:System.Reflection.FieldInfo" /> that represents the property or field denoted by <paramref name="propertyOrFieldName" />.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> whose <see cref="P:System.Linq.Expressions.Expression.Type" /> contains a property or field named <paramref name="propertyOrFieldName" />.</param>
|
||||
/// <param name="propertyOrFieldName">The name of a property or field.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> or <paramref name="propertyOrFieldName" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">No property or field named <paramref name="propertyOrFieldName" /> is defined in <paramref name="expression" />.Type or its base types.</exception>
|
||||
// Token: 0x060000B8 RID: 184 RVA: 0x000054CC File Offset: 0x000036CC
|
||||
public static MemberExpression PropertyOrField(Expression expression, string propertyOrFieldName)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
if (propertyOrFieldName == null)
|
||||
{
|
||||
throw new ArgumentNullException("propertyOrFieldName");
|
||||
}
|
||||
PropertyInfo property = expression.Type.GetProperty(propertyOrFieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
|
||||
if (property != null)
|
||||
{
|
||||
return new MemberExpression(expression, property, property.PropertyType);
|
||||
}
|
||||
FieldInfo field = expression.Type.GetField(propertyOrFieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
|
||||
if (field != null)
|
||||
{
|
||||
return new MemberExpression(expression, field, field.FieldType);
|
||||
}
|
||||
throw new ArgumentException(string.Format("No field or property named {0} on {1}", propertyOrFieldName, expression.Type));
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents an expression that has a constant value of type <see cref="T:System.Linq.Expressions.Expression" />.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.Quote" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property set to the specified value.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> is null.</exception>
|
||||
// Token: 0x060000B9 RID: 185 RVA: 0x00005558 File Offset: 0x00003758
|
||||
public static UnaryExpression Quote(Expression expression)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
return new UnaryExpression(ExpressionType.Quote, expression, expression.GetType());
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents an explicit reference or boxing conversion where null is supplied if the conversion fails.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.TypeAs" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> and <see cref="P:System.Linq.Expressions.Expression.Type" /> properties set to the specified values.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.Expression.Type" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> or <paramref name="type" /> is null.</exception>
|
||||
// Token: 0x060000BA RID: 186 RVA: 0x0000557C File Offset: 0x0000377C
|
||||
public static UnaryExpression TypeAs(Expression expression, Type type)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentNullException("type");
|
||||
}
|
||||
if (type.IsValueType && !type.IsNullable())
|
||||
{
|
||||
throw new ArgumentException("TypeAs expect a reference or a nullable type");
|
||||
}
|
||||
return new UnaryExpression(ExpressionType.TypeAs, expression, type);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.TypeBinaryExpression" />.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.TypeBinaryExpression" /> for which the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property is equal to <see cref="F:System.Linq.Expressions.ExpressionType.TypeIs" /> and for which the <see cref="P:System.Linq.Expressions.TypeBinaryExpression.Expression" /> and <see cref="P:System.Linq.Expressions.TypeBinaryExpression.TypeOperand" /> properties are set to the specified values.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.TypeBinaryExpression.Expression" /> property equal to.</param>
|
||||
/// <param name="type">A <see cref="T:System.Type" /> to set the <see cref="P:System.Linq.Expressions.TypeBinaryExpression.TypeOperand" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> or <paramref name="type" /> is null.</exception>
|
||||
// Token: 0x060000BB RID: 187 RVA: 0x000055D8 File Offset: 0x000037D8
|
||||
public static TypeBinaryExpression TypeIs(Expression expression, Type type)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
throw new ArgumentNullException("expression");
|
||||
}
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentNullException("type");
|
||||
}
|
||||
Expression.CheckNotVoid(type);
|
||||
return new TypeBinaryExpression(ExpressionType.TypeIs, expression, type, typeof(bool));
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a unary plus operation.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.UnaryPlus" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property set to the specified value.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The unary plus operator is not defined for <paramref name="expression" />.Type.</exception>
|
||||
// Token: 0x060000BC RID: 188 RVA: 0x00005618 File Offset: 0x00003818
|
||||
public static UnaryExpression UnaryPlus(Expression expression)
|
||||
{
|
||||
return Expression.UnaryPlus(expression, null);
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.Linq.Expressions.UnaryExpression" /> that represents a unary plus operation. The implementing method can be specified.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.UnaryExpression" /> that has the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property equal to <see cref="F:System.Linq.Expressions.ExpressionType.UnaryPlus" /> and the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> and <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> properties set to the specified values.</returns>
|
||||
/// <param name="expression">An <see cref="T:System.Linq.Expressions.Expression" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Operand" /> property equal to.</param>
|
||||
/// <param name="method">A <see cref="T:System.Reflection.MethodInfo" /> to set the <see cref="P:System.Linq.Expressions.UnaryExpression.Method" /> property equal to.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="expression" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="method" /> is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="method" /> is null and the unary plus operator is not defined for <paramref name="expression" />.Type.-or-<paramref name="expression" />.Type (or its corresponding non-nullable type if it is a nullable value type) is not assignable to the argument type of the method represented by <paramref name="method" />.</exception>
|
||||
// Token: 0x060000BD RID: 189 RVA: 0x00005624 File Offset: 0x00003824
|
||||
public static UnaryExpression UnaryPlus(Expression expression, MethodInfo method)
|
||||
{
|
||||
method = Expression.UnaryCoreCheck("op_UnaryPlus", expression, method, (Type type) => Expression.IsNumber(type));
|
||||
return Expression.MakeSimpleUnary(ExpressionType.UnaryPlus, expression, method);
|
||||
}
|
||||
|
||||
// Token: 0x060000BE RID: 190 RVA: 0x00005668 File Offset: 0x00003868
|
||||
private static bool IsInt(Type t)
|
||||
{
|
||||
return t == typeof(byte) || t == typeof(sbyte) || t == typeof(short) || t == typeof(ushort) || t == typeof(int) || t == typeof(uint) || t == typeof(long) || t == typeof(ulong);
|
||||
}
|
||||
|
||||
// Token: 0x060000BF RID: 191 RVA: 0x000056F8 File Offset: 0x000038F8
|
||||
private static bool IsIntOrBool(Type t)
|
||||
{
|
||||
return Expression.IsInt(t) || t == typeof(bool);
|
||||
}
|
||||
|
||||
// Token: 0x060000C0 RID: 192 RVA: 0x00005718 File Offset: 0x00003918
|
||||
private static bool IsNumber(Type t)
|
||||
{
|
||||
return Expression.IsInt(t) || t == typeof(float) || t == typeof(double);
|
||||
}
|
||||
|
||||
// Token: 0x060000C1 RID: 193 RVA: 0x00005748 File Offset: 0x00003948
|
||||
private static bool IsSignedNumber(Type t)
|
||||
{
|
||||
return Expression.IsNumber(t) && !Expression.IsUnsigned(t);
|
||||
}
|
||||
|
||||
// Token: 0x060000C2 RID: 194 RVA: 0x00005764 File Offset: 0x00003964
|
||||
internal static bool IsUnsigned(Type t)
|
||||
{
|
||||
if (t.IsPointer)
|
||||
{
|
||||
return Expression.IsUnsigned(t.GetElementType());
|
||||
}
|
||||
return t == typeof(ushort) || t == typeof(uint) || t == typeof(ulong) || t == typeof(byte);
|
||||
}
|
||||
|
||||
// Token: 0x060000C3 RID: 195 RVA: 0x000057C8 File Offset: 0x000039C8
|
||||
internal virtual void Emit(EmitContext ec)
|
||||
{
|
||||
throw new NotImplementedException(string.Format("Emit method is not implemented in expression type {0}", base.GetType()));
|
||||
}
|
||||
|
||||
// Token: 0x04000003 RID: 3
|
||||
internal const BindingFlags PublicInstance = BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy;
|
||||
|
||||
// Token: 0x04000004 RID: 4
|
||||
internal const BindingFlags NonPublicInstance = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
|
||||
|
||||
// Token: 0x04000005 RID: 5
|
||||
internal const BindingFlags PublicStatic = BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy;
|
||||
|
||||
// Token: 0x04000006 RID: 6
|
||||
internal const BindingFlags AllInstance = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
|
||||
|
||||
// Token: 0x04000007 RID: 7
|
||||
internal const BindingFlags AllStatic = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
|
||||
|
||||
// Token: 0x04000008 RID: 8
|
||||
internal const BindingFlags All = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
|
||||
|
||||
// Token: 0x04000009 RID: 9
|
||||
private ExpressionType node_type;
|
||||
|
||||
// Token: 0x0400000A RID: 10
|
||||
private Type type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents a strongly typed lambda expression as a data structure in the form of an expression tree. This class cannot be inherited.</summary>
|
||||
/// <typeparam name="TDelegate">The type of the delegate that the <see cref="T:System.Linq.Expressions.Expression`1" /> represents.</typeparam>
|
||||
// Token: 0x02000003 RID: 3
|
||||
public sealed class Expression<TDelegate> : LambdaExpression
|
||||
{
|
||||
// Token: 0x06000002 RID: 2 RVA: 0x000020F4 File Offset: 0x000002F4
|
||||
internal Expression(Expression body, ReadOnlyCollection<ParameterExpression> parameters)
|
||||
: base(typeof(TDelegate), body, parameters)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Compiles the lambda expression described by the expression tree into executable code.</summary>
|
||||
/// <returns>A delegate of type <paramref name="TDelegate" /> that represents the lambda expression described by the <see cref="T:System.Linq.Expressions.Expression`1" />.</returns>
|
||||
// Token: 0x06000003 RID: 3 RVA: 0x00002108 File Offset: 0x00000308
|
||||
public new TDelegate Compile()
|
||||
{
|
||||
return (TDelegate)((object)base.Compile());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,424 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
// Token: 0x0200001D RID: 29
|
||||
internal class ExpressionPrinter : ExpressionVisitor
|
||||
{
|
||||
// Token: 0x060001AC RID: 428 RVA: 0x00009E64 File Offset: 0x00008064
|
||||
private ExpressionPrinter(StringBuilder builder)
|
||||
{
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
// Token: 0x060001AD RID: 429 RVA: 0x00009E74 File Offset: 0x00008074
|
||||
private ExpressionPrinter()
|
||||
: this(new StringBuilder())
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060001AE RID: 430 RVA: 0x00009E84 File Offset: 0x00008084
|
||||
public static string ToString(Expression expression)
|
||||
{
|
||||
ExpressionPrinter expressionPrinter = new ExpressionPrinter();
|
||||
expressionPrinter.Visit(expression);
|
||||
return expressionPrinter.builder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x060001AF RID: 431 RVA: 0x00009EAC File Offset: 0x000080AC
|
||||
public static string ToString(ElementInit init)
|
||||
{
|
||||
ExpressionPrinter expressionPrinter = new ExpressionPrinter();
|
||||
expressionPrinter.VisitElementInitializer(init);
|
||||
return expressionPrinter.builder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x060001B0 RID: 432 RVA: 0x00009ED4 File Offset: 0x000080D4
|
||||
public static string ToString(MemberBinding binding)
|
||||
{
|
||||
ExpressionPrinter expressionPrinter = new ExpressionPrinter();
|
||||
expressionPrinter.VisitBinding(binding);
|
||||
return expressionPrinter.builder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x060001B1 RID: 433 RVA: 0x00009EFC File Offset: 0x000080FC
|
||||
private void Print(string str)
|
||||
{
|
||||
this.builder.Append(str);
|
||||
}
|
||||
|
||||
// Token: 0x060001B2 RID: 434 RVA: 0x00009F0C File Offset: 0x0000810C
|
||||
private void Print(object obj)
|
||||
{
|
||||
this.builder.Append(obj);
|
||||
}
|
||||
|
||||
// Token: 0x060001B3 RID: 435 RVA: 0x00009F1C File Offset: 0x0000811C
|
||||
private void Print(string str, params object[] objs)
|
||||
{
|
||||
this.builder.AppendFormat(str, objs);
|
||||
}
|
||||
|
||||
// Token: 0x060001B4 RID: 436 RVA: 0x00009F2C File Offset: 0x0000812C
|
||||
protected override void VisitElementInitializer(ElementInit initializer)
|
||||
{
|
||||
this.Print(initializer.AddMethod);
|
||||
this.Print("(");
|
||||
this.VisitExpressionList(initializer.Arguments);
|
||||
this.Print(")");
|
||||
}
|
||||
|
||||
// Token: 0x060001B5 RID: 437 RVA: 0x00009F68 File Offset: 0x00008168
|
||||
protected override void VisitUnary(UnaryExpression unary)
|
||||
{
|
||||
ExpressionType nodeType = unary.NodeType;
|
||||
if (nodeType != ExpressionType.Convert && nodeType != ExpressionType.ConvertChecked)
|
||||
{
|
||||
if (nodeType == ExpressionType.Negate)
|
||||
{
|
||||
this.Print("-");
|
||||
this.Visit(unary.Operand);
|
||||
return;
|
||||
}
|
||||
if (nodeType == ExpressionType.UnaryPlus)
|
||||
{
|
||||
this.Print("+");
|
||||
this.Visit(unary.Operand);
|
||||
return;
|
||||
}
|
||||
if (nodeType != ExpressionType.ArrayLength && nodeType != ExpressionType.Not)
|
||||
{
|
||||
if (nodeType == ExpressionType.Quote)
|
||||
{
|
||||
this.Visit(unary.Operand);
|
||||
return;
|
||||
}
|
||||
if (nodeType != ExpressionType.TypeAs)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
this.Print("(");
|
||||
this.Visit(unary.Operand);
|
||||
this.Print(" As {0})", new object[] { unary.Type.Name });
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.Print("{0}(", new object[] { unary.NodeType });
|
||||
this.Visit(unary.Operand);
|
||||
this.Print(")");
|
||||
}
|
||||
|
||||
// Token: 0x060001B6 RID: 438 RVA: 0x0000A070 File Offset: 0x00008270
|
||||
private static string OperatorToString(BinaryExpression binary)
|
||||
{
|
||||
switch (binary.NodeType)
|
||||
{
|
||||
case ExpressionType.Add:
|
||||
case ExpressionType.AddChecked:
|
||||
return "+";
|
||||
case ExpressionType.And:
|
||||
return (!ExpressionPrinter.IsBoolean(binary)) ? "&" : "And";
|
||||
case ExpressionType.AndAlso:
|
||||
return "&&";
|
||||
case ExpressionType.Coalesce:
|
||||
return "??";
|
||||
case ExpressionType.Divide:
|
||||
return "/";
|
||||
case ExpressionType.Equal:
|
||||
return "=";
|
||||
case ExpressionType.ExclusiveOr:
|
||||
return "^";
|
||||
case ExpressionType.GreaterThan:
|
||||
return ">";
|
||||
case ExpressionType.GreaterThanOrEqual:
|
||||
return ">=";
|
||||
case ExpressionType.LeftShift:
|
||||
return "<<";
|
||||
case ExpressionType.LessThan:
|
||||
return "<";
|
||||
case ExpressionType.LessThanOrEqual:
|
||||
return "<=";
|
||||
case ExpressionType.Modulo:
|
||||
return "%";
|
||||
case ExpressionType.Multiply:
|
||||
case ExpressionType.MultiplyChecked:
|
||||
return "*";
|
||||
case ExpressionType.NotEqual:
|
||||
return "!=";
|
||||
case ExpressionType.Or:
|
||||
return (!ExpressionPrinter.IsBoolean(binary)) ? "|" : "Or";
|
||||
case ExpressionType.OrElse:
|
||||
return "||";
|
||||
case ExpressionType.Power:
|
||||
return "^";
|
||||
case ExpressionType.RightShift:
|
||||
return ">>";
|
||||
case ExpressionType.Subtract:
|
||||
case ExpressionType.SubtractChecked:
|
||||
return "-";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x060001B7 RID: 439 RVA: 0x0000A1E4 File Offset: 0x000083E4
|
||||
private static bool IsBoolean(Expression expression)
|
||||
{
|
||||
return expression.Type == typeof(bool) || expression.Type == typeof(bool?);
|
||||
}
|
||||
|
||||
// Token: 0x060001B8 RID: 440 RVA: 0x0000A21C File Offset: 0x0000841C
|
||||
private void PrintArrayIndex(BinaryExpression index)
|
||||
{
|
||||
this.Visit(index.Left);
|
||||
this.Print("[");
|
||||
this.Visit(index.Right);
|
||||
this.Print("]");
|
||||
}
|
||||
|
||||
// Token: 0x060001B9 RID: 441 RVA: 0x0000A258 File Offset: 0x00008458
|
||||
protected override void VisitBinary(BinaryExpression binary)
|
||||
{
|
||||
ExpressionType nodeType = binary.NodeType;
|
||||
if (nodeType != ExpressionType.ArrayIndex)
|
||||
{
|
||||
this.Print("(");
|
||||
this.Visit(binary.Left);
|
||||
this.Print(" {0} ", new object[] { ExpressionPrinter.OperatorToString(binary) });
|
||||
this.Visit(binary.Right);
|
||||
this.Print(")");
|
||||
return;
|
||||
}
|
||||
this.PrintArrayIndex(binary);
|
||||
}
|
||||
|
||||
// Token: 0x060001BA RID: 442 RVA: 0x0000A2C8 File Offset: 0x000084C8
|
||||
protected override void VisitTypeIs(TypeBinaryExpression type)
|
||||
{
|
||||
ExpressionType nodeType = type.NodeType;
|
||||
if (nodeType != ExpressionType.TypeIs)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
this.Print("(");
|
||||
this.Visit(type.Expression);
|
||||
this.Print(" Is {0})", new object[] { type.TypeOperand.Name });
|
||||
}
|
||||
|
||||
// Token: 0x060001BB RID: 443 RVA: 0x0000A328 File Offset: 0x00008528
|
||||
protected override void VisitConstant(ConstantExpression constant)
|
||||
{
|
||||
object value = constant.Value;
|
||||
if (value == null)
|
||||
{
|
||||
this.Print("null");
|
||||
}
|
||||
else if (value is string)
|
||||
{
|
||||
this.Print("\"");
|
||||
this.Print(value);
|
||||
this.Print("\"");
|
||||
}
|
||||
else if (!ExpressionPrinter.HasStringRepresentation(value))
|
||||
{
|
||||
this.Print("value(");
|
||||
this.Print(value);
|
||||
this.Print(")");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Print(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001BC RID: 444 RVA: 0x0000A3B4 File Offset: 0x000085B4
|
||||
private static bool HasStringRepresentation(object obj)
|
||||
{
|
||||
return obj.ToString() != obj.GetType().ToString();
|
||||
}
|
||||
|
||||
// Token: 0x060001BD RID: 445 RVA: 0x0000A3D8 File Offset: 0x000085D8
|
||||
protected override void VisitConditional(ConditionalExpression conditional)
|
||||
{
|
||||
this.Print("IIF(");
|
||||
this.Visit(conditional.Test);
|
||||
this.Print(", ");
|
||||
this.Visit(conditional.IfTrue);
|
||||
this.Print(", ");
|
||||
this.Visit(conditional.IfFalse);
|
||||
this.Print(")");
|
||||
}
|
||||
|
||||
// Token: 0x060001BE RID: 446 RVA: 0x0000A438 File Offset: 0x00008638
|
||||
protected override void VisitParameter(ParameterExpression parameter)
|
||||
{
|
||||
this.Print(parameter.Name ?? "<param>");
|
||||
}
|
||||
|
||||
// Token: 0x060001BF RID: 447 RVA: 0x0000A454 File Offset: 0x00008654
|
||||
protected override void VisitMemberAccess(MemberExpression access)
|
||||
{
|
||||
if (access.Expression == null)
|
||||
{
|
||||
this.Print(access.Member.DeclaringType.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Visit(access.Expression);
|
||||
}
|
||||
this.Print(".{0}", new object[] { access.Member.Name });
|
||||
}
|
||||
|
||||
// Token: 0x060001C0 RID: 448 RVA: 0x0000A4B4 File Offset: 0x000086B4
|
||||
protected override void VisitMethodCall(MethodCallExpression call)
|
||||
{
|
||||
if (call.Object != null)
|
||||
{
|
||||
this.Visit(call.Object);
|
||||
this.Print(".");
|
||||
}
|
||||
this.Print(call.Method.Name);
|
||||
this.Print("(");
|
||||
this.VisitExpressionList(call.Arguments);
|
||||
this.Print(")");
|
||||
}
|
||||
|
||||
// Token: 0x060001C1 RID: 449 RVA: 0x0000A518 File Offset: 0x00008718
|
||||
protected override void VisitMemberAssignment(MemberAssignment assignment)
|
||||
{
|
||||
this.Print("{0} = ", new object[] { assignment.Member.Name });
|
||||
this.Visit(assignment.Expression);
|
||||
}
|
||||
|
||||
// Token: 0x060001C2 RID: 450 RVA: 0x0000A550 File Offset: 0x00008750
|
||||
protected override void VisitMemberMemberBinding(MemberMemberBinding binding)
|
||||
{
|
||||
this.Print(binding.Member.Name);
|
||||
this.Print(" = {");
|
||||
this.VisitList<MemberBinding>(binding.Bindings, new Action<MemberBinding>(this.VisitBinding));
|
||||
this.Print("}");
|
||||
}
|
||||
|
||||
// Token: 0x060001C3 RID: 451 RVA: 0x0000A5A0 File Offset: 0x000087A0
|
||||
protected override void VisitMemberListBinding(MemberListBinding binding)
|
||||
{
|
||||
this.Print(binding.Member.Name);
|
||||
this.Print(" = {");
|
||||
this.VisitList<ElementInit>(binding.Initializers, new Action<ElementInit>(this.VisitElementInitializer));
|
||||
this.Print("}");
|
||||
}
|
||||
|
||||
// Token: 0x060001C4 RID: 452 RVA: 0x0000A5F0 File Offset: 0x000087F0
|
||||
protected override void VisitList<T>(ReadOnlyCollection<T> list, Action<T> visitor)
|
||||
{
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
this.Print(", ");
|
||||
}
|
||||
visitor(list[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001C5 RID: 453 RVA: 0x0000A634 File Offset: 0x00008834
|
||||
protected override void VisitLambda(LambdaExpression lambda)
|
||||
{
|
||||
if (lambda.Parameters.Count != 1)
|
||||
{
|
||||
this.Print("(");
|
||||
this.VisitList<ParameterExpression>(lambda.Parameters, new Action<ParameterExpression>(this.Visit));
|
||||
this.Print(")");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Visit(lambda.Parameters[0]);
|
||||
}
|
||||
this.Print(" => ");
|
||||
this.Visit(lambda.Body);
|
||||
}
|
||||
|
||||
// Token: 0x060001C6 RID: 454 RVA: 0x0000A6B0 File Offset: 0x000088B0
|
||||
protected override void VisitNew(NewExpression nex)
|
||||
{
|
||||
this.Print("new {0}(", new object[] { nex.Type.Name });
|
||||
if (nex.Members != null && nex.Members.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < nex.Members.Count; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
this.Print(", ");
|
||||
}
|
||||
this.Print("{0} = ", new object[] { nex.Members[i].Name });
|
||||
this.Visit(nex.Arguments[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.VisitExpressionList(nex.Arguments);
|
||||
}
|
||||
this.Print(")");
|
||||
}
|
||||
|
||||
// Token: 0x060001C7 RID: 455 RVA: 0x0000A77C File Offset: 0x0000897C
|
||||
protected override void VisitMemberInit(MemberInitExpression init)
|
||||
{
|
||||
this.Visit(init.NewExpression);
|
||||
this.Print(" {");
|
||||
this.VisitList<MemberBinding>(init.Bindings, new Action<MemberBinding>(this.VisitBinding));
|
||||
this.Print("}");
|
||||
}
|
||||
|
||||
// Token: 0x060001C8 RID: 456 RVA: 0x0000A7C4 File Offset: 0x000089C4
|
||||
protected override void VisitListInit(ListInitExpression init)
|
||||
{
|
||||
this.Visit(init.NewExpression);
|
||||
this.Print(" {");
|
||||
this.VisitList<ElementInit>(init.Initializers, new Action<ElementInit>(this.VisitElementInitializer));
|
||||
this.Print("}");
|
||||
}
|
||||
|
||||
// Token: 0x060001C9 RID: 457 RVA: 0x0000A80C File Offset: 0x00008A0C
|
||||
protected override void VisitNewArray(NewArrayExpression newArray)
|
||||
{
|
||||
this.Print("new ");
|
||||
ExpressionType nodeType = newArray.NodeType;
|
||||
if (nodeType == ExpressionType.NewArrayInit)
|
||||
{
|
||||
this.Print("[] {");
|
||||
this.VisitExpressionList(newArray.Expressions);
|
||||
this.Print("}");
|
||||
return;
|
||||
}
|
||||
if (nodeType != ExpressionType.NewArrayBounds)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
this.Print(newArray.Type);
|
||||
this.Print("(");
|
||||
this.VisitExpressionList(newArray.Expressions);
|
||||
this.Print(")");
|
||||
}
|
||||
|
||||
// Token: 0x060001CA RID: 458 RVA: 0x0000A898 File Offset: 0x00008A98
|
||||
protected override void VisitInvocation(InvocationExpression invocation)
|
||||
{
|
||||
this.Print("Invoke(");
|
||||
this.Visit(invocation.Expression);
|
||||
if (invocation.Arguments.Count != 0)
|
||||
{
|
||||
this.Print(", ");
|
||||
this.VisitExpressionList(invocation.Arguments);
|
||||
}
|
||||
this.Print(")");
|
||||
}
|
||||
|
||||
// Token: 0x04000074 RID: 116
|
||||
private const string ListSeparator = ", ";
|
||||
|
||||
// Token: 0x04000075 RID: 117
|
||||
private StringBuilder builder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,368 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
// Token: 0x0200001E RID: 30
|
||||
internal abstract class ExpressionTransformer
|
||||
{
|
||||
// Token: 0x060001CC RID: 460 RVA: 0x0000A8F8 File Offset: 0x00008AF8
|
||||
public Expression Transform(Expression expression)
|
||||
{
|
||||
return this.Visit(expression);
|
||||
}
|
||||
|
||||
// Token: 0x060001CD RID: 461 RVA: 0x0000A904 File Offset: 0x00008B04
|
||||
protected virtual Expression Visit(Expression exp)
|
||||
{
|
||||
if (exp == null)
|
||||
{
|
||||
return exp;
|
||||
}
|
||||
switch (exp.NodeType)
|
||||
{
|
||||
case ExpressionType.Add:
|
||||
case ExpressionType.AddChecked:
|
||||
case ExpressionType.And:
|
||||
case ExpressionType.AndAlso:
|
||||
case ExpressionType.ArrayIndex:
|
||||
case ExpressionType.Coalesce:
|
||||
case ExpressionType.Divide:
|
||||
case ExpressionType.Equal:
|
||||
case ExpressionType.ExclusiveOr:
|
||||
case ExpressionType.GreaterThan:
|
||||
case ExpressionType.GreaterThanOrEqual:
|
||||
case ExpressionType.LeftShift:
|
||||
case ExpressionType.LessThan:
|
||||
case ExpressionType.LessThanOrEqual:
|
||||
case ExpressionType.Modulo:
|
||||
case ExpressionType.Multiply:
|
||||
case ExpressionType.MultiplyChecked:
|
||||
case ExpressionType.NotEqual:
|
||||
case ExpressionType.Or:
|
||||
case ExpressionType.OrElse:
|
||||
case ExpressionType.Power:
|
||||
case ExpressionType.RightShift:
|
||||
case ExpressionType.Subtract:
|
||||
case ExpressionType.SubtractChecked:
|
||||
return this.VisitBinary((BinaryExpression)exp);
|
||||
case ExpressionType.ArrayLength:
|
||||
case ExpressionType.Convert:
|
||||
case ExpressionType.ConvertChecked:
|
||||
case ExpressionType.Negate:
|
||||
case ExpressionType.UnaryPlus:
|
||||
case ExpressionType.NegateChecked:
|
||||
case ExpressionType.Not:
|
||||
case ExpressionType.Quote:
|
||||
case ExpressionType.TypeAs:
|
||||
return this.VisitUnary((UnaryExpression)exp);
|
||||
case ExpressionType.Call:
|
||||
return this.VisitMethodCall((MethodCallExpression)exp);
|
||||
case ExpressionType.Conditional:
|
||||
return this.VisitConditional((ConditionalExpression)exp);
|
||||
case ExpressionType.Constant:
|
||||
return this.VisitConstant((ConstantExpression)exp);
|
||||
case ExpressionType.Invoke:
|
||||
return this.VisitInvocation((InvocationExpression)exp);
|
||||
case ExpressionType.Lambda:
|
||||
return this.VisitLambda((LambdaExpression)exp);
|
||||
case ExpressionType.ListInit:
|
||||
return this.VisitListInit((ListInitExpression)exp);
|
||||
case ExpressionType.MemberAccess:
|
||||
return this.VisitMemberAccess((MemberExpression)exp);
|
||||
case ExpressionType.MemberInit:
|
||||
return this.VisitMemberInit((MemberInitExpression)exp);
|
||||
case ExpressionType.New:
|
||||
return this.VisitNew((NewExpression)exp);
|
||||
case ExpressionType.NewArrayInit:
|
||||
case ExpressionType.NewArrayBounds:
|
||||
return this.VisitNewArray((NewArrayExpression)exp);
|
||||
case ExpressionType.Parameter:
|
||||
return this.VisitParameter((ParameterExpression)exp);
|
||||
case ExpressionType.TypeIs:
|
||||
return this.VisitTypeIs((TypeBinaryExpression)exp);
|
||||
default:
|
||||
throw new Exception(string.Format("Unhandled expression type: '{0}'", exp.NodeType));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001CE RID: 462 RVA: 0x0000AAB4 File Offset: 0x00008CB4
|
||||
protected virtual MemberBinding VisitBinding(MemberBinding binding)
|
||||
{
|
||||
switch (binding.BindingType)
|
||||
{
|
||||
case MemberBindingType.Assignment:
|
||||
return this.VisitMemberAssignment((MemberAssignment)binding);
|
||||
case MemberBindingType.MemberBinding:
|
||||
return this.VisitMemberMemberBinding((MemberMemberBinding)binding);
|
||||
case MemberBindingType.ListBinding:
|
||||
return this.VisitMemberListBinding((MemberListBinding)binding);
|
||||
default:
|
||||
throw new Exception(string.Format("Unhandled binding type '{0}'", binding.BindingType));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001CF RID: 463 RVA: 0x0000AB20 File Offset: 0x00008D20
|
||||
protected virtual ElementInit VisitElementInitializer(ElementInit initializer)
|
||||
{
|
||||
ReadOnlyCollection<Expression> readOnlyCollection = this.VisitExpressionList(initializer.Arguments);
|
||||
if (readOnlyCollection != initializer.Arguments)
|
||||
{
|
||||
return Expression.ElementInit(initializer.AddMethod, readOnlyCollection);
|
||||
}
|
||||
return initializer;
|
||||
}
|
||||
|
||||
// Token: 0x060001D0 RID: 464 RVA: 0x0000AB54 File Offset: 0x00008D54
|
||||
protected virtual Expression VisitUnary(UnaryExpression u)
|
||||
{
|
||||
Expression expression = this.Visit(u.Operand);
|
||||
if (expression != u.Operand)
|
||||
{
|
||||
return Expression.MakeUnary(u.NodeType, expression, u.Type, u.Method);
|
||||
}
|
||||
return u;
|
||||
}
|
||||
|
||||
// Token: 0x060001D1 RID: 465 RVA: 0x0000AB94 File Offset: 0x00008D94
|
||||
protected virtual Expression VisitBinary(BinaryExpression b)
|
||||
{
|
||||
Expression expression = this.Visit(b.Left);
|
||||
Expression expression2 = this.Visit(b.Right);
|
||||
Expression expression3 = this.Visit(b.Conversion);
|
||||
if (expression == b.Left && expression2 == b.Right && expression3 == b.Conversion)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
if (b.NodeType == ExpressionType.Coalesce && b.Conversion != null)
|
||||
{
|
||||
return Expression.Coalesce(expression, expression2, expression3 as LambdaExpression);
|
||||
}
|
||||
return Expression.MakeBinary(b.NodeType, expression, expression2, b.IsLiftedToNull, b.Method);
|
||||
}
|
||||
|
||||
// Token: 0x060001D2 RID: 466 RVA: 0x0000AC2C File Offset: 0x00008E2C
|
||||
protected virtual Expression VisitTypeIs(TypeBinaryExpression b)
|
||||
{
|
||||
Expression expression = this.Visit(b.Expression);
|
||||
if (expression != b.Expression)
|
||||
{
|
||||
return Expression.TypeIs(expression, b.TypeOperand);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
// Token: 0x060001D3 RID: 467 RVA: 0x0000AC60 File Offset: 0x00008E60
|
||||
protected virtual Expression VisitConstant(ConstantExpression c)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
|
||||
// Token: 0x060001D4 RID: 468 RVA: 0x0000AC64 File Offset: 0x00008E64
|
||||
protected virtual Expression VisitConditional(ConditionalExpression c)
|
||||
{
|
||||
Expression expression = this.Visit(c.Test);
|
||||
Expression expression2 = this.Visit(c.IfTrue);
|
||||
Expression expression3 = this.Visit(c.IfFalse);
|
||||
if (expression != c.Test || expression2 != c.IfTrue || expression3 != c.IfFalse)
|
||||
{
|
||||
return Expression.Condition(expression, expression2, expression3);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
// Token: 0x060001D5 RID: 469 RVA: 0x0000ACC8 File Offset: 0x00008EC8
|
||||
protected virtual Expression VisitParameter(ParameterExpression p)
|
||||
{
|
||||
return p;
|
||||
}
|
||||
|
||||
// Token: 0x060001D6 RID: 470 RVA: 0x0000ACCC File Offset: 0x00008ECC
|
||||
protected virtual Expression VisitMemberAccess(MemberExpression m)
|
||||
{
|
||||
Expression expression = this.Visit(m.Expression);
|
||||
if (expression != m.Expression)
|
||||
{
|
||||
return Expression.MakeMemberAccess(expression, m.Member);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
// Token: 0x060001D7 RID: 471 RVA: 0x0000AD00 File Offset: 0x00008F00
|
||||
protected virtual Expression VisitMethodCall(MethodCallExpression m)
|
||||
{
|
||||
Expression expression = this.Visit(m.Object);
|
||||
IEnumerable<Expression> enumerable = this.VisitExpressionList(m.Arguments);
|
||||
if (expression != m.Object || enumerable != m.Arguments)
|
||||
{
|
||||
return Expression.Call(expression, m.Method, enumerable);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
// Token: 0x060001D8 RID: 472 RVA: 0x0000AD50 File Offset: 0x00008F50
|
||||
protected virtual ReadOnlyCollection<Expression> VisitExpressionList(ReadOnlyCollection<Expression> original)
|
||||
{
|
||||
IList<Expression> list = this.VisitList<Expression>(original, new Func<Expression, Expression>(this.Visit));
|
||||
if (list == null)
|
||||
{
|
||||
return original;
|
||||
}
|
||||
return new ReadOnlyCollection<Expression>(list);
|
||||
}
|
||||
|
||||
// Token: 0x060001D9 RID: 473 RVA: 0x0000AD80 File Offset: 0x00008F80
|
||||
protected virtual MemberAssignment VisitMemberAssignment(MemberAssignment assignment)
|
||||
{
|
||||
Expression expression = this.Visit(assignment.Expression);
|
||||
if (expression != assignment.Expression)
|
||||
{
|
||||
return Expression.Bind(assignment.Member, expression);
|
||||
}
|
||||
return assignment;
|
||||
}
|
||||
|
||||
// Token: 0x060001DA RID: 474 RVA: 0x0000ADB4 File Offset: 0x00008FB4
|
||||
protected virtual MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding binding)
|
||||
{
|
||||
IEnumerable<MemberBinding> enumerable = this.VisitBindingList(binding.Bindings);
|
||||
if (enumerable != binding.Bindings)
|
||||
{
|
||||
return Expression.MemberBind(binding.Member, enumerable);
|
||||
}
|
||||
return binding;
|
||||
}
|
||||
|
||||
// Token: 0x060001DB RID: 475 RVA: 0x0000ADE8 File Offset: 0x00008FE8
|
||||
protected virtual MemberListBinding VisitMemberListBinding(MemberListBinding binding)
|
||||
{
|
||||
IEnumerable<ElementInit> enumerable = this.VisitElementInitializerList(binding.Initializers);
|
||||
if (enumerable != binding.Initializers)
|
||||
{
|
||||
return Expression.ListBind(binding.Member, enumerable);
|
||||
}
|
||||
return binding;
|
||||
}
|
||||
|
||||
// Token: 0x060001DC RID: 476 RVA: 0x0000AE1C File Offset: 0x0000901C
|
||||
protected virtual IEnumerable<MemberBinding> VisitBindingList(ReadOnlyCollection<MemberBinding> original)
|
||||
{
|
||||
return this.VisitList<MemberBinding>(original, new Func<MemberBinding, MemberBinding>(this.VisitBinding));
|
||||
}
|
||||
|
||||
// Token: 0x060001DD RID: 477 RVA: 0x0000AE34 File Offset: 0x00009034
|
||||
protected virtual IEnumerable<ElementInit> VisitElementInitializerList(ReadOnlyCollection<ElementInit> original)
|
||||
{
|
||||
return this.VisitList<ElementInit>(original, new Func<ElementInit, ElementInit>(this.VisitElementInitializer));
|
||||
}
|
||||
|
||||
// Token: 0x060001DE RID: 478 RVA: 0x0000AE4C File Offset: 0x0000904C
|
||||
private IList<TElement> VisitList<TElement>(ReadOnlyCollection<TElement> original, Func<TElement, TElement> visit)
|
||||
{
|
||||
List<TElement> list = null;
|
||||
int i = 0;
|
||||
int count = original.Count;
|
||||
while (i < count)
|
||||
{
|
||||
TElement telement = visit(original[i]);
|
||||
if (list != null)
|
||||
{
|
||||
list.Add(telement);
|
||||
}
|
||||
else if (!EqualityComparer<TElement>.Default.Equals(telement, original[i]))
|
||||
{
|
||||
list = new List<TElement>(count);
|
||||
for (int j = 0; j < i; j++)
|
||||
{
|
||||
list.Add(original[j]);
|
||||
}
|
||||
list.Add(telement);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (list != null)
|
||||
{
|
||||
return list;
|
||||
}
|
||||
return original;
|
||||
}
|
||||
|
||||
// Token: 0x060001DF RID: 479 RVA: 0x0000AEE8 File Offset: 0x000090E8
|
||||
protected virtual Expression VisitLambda(LambdaExpression lambda)
|
||||
{
|
||||
Expression expression = this.Visit(lambda.Body);
|
||||
if (expression != lambda.Body)
|
||||
{
|
||||
return Expression.Lambda(lambda.Type, expression, lambda.Parameters);
|
||||
}
|
||||
return lambda;
|
||||
}
|
||||
|
||||
// Token: 0x060001E0 RID: 480 RVA: 0x0000AF24 File Offset: 0x00009124
|
||||
protected virtual NewExpression VisitNew(NewExpression nex)
|
||||
{
|
||||
IEnumerable<Expression> enumerable = this.VisitExpressionList(nex.Arguments);
|
||||
if (enumerable == nex.Arguments)
|
||||
{
|
||||
return nex;
|
||||
}
|
||||
if (nex.Members != null)
|
||||
{
|
||||
return Expression.New(nex.Constructor, enumerable, nex.Members);
|
||||
}
|
||||
return Expression.New(nex.Constructor, enumerable);
|
||||
}
|
||||
|
||||
// Token: 0x060001E1 RID: 481 RVA: 0x0000AF78 File Offset: 0x00009178
|
||||
protected virtual Expression VisitMemberInit(MemberInitExpression init)
|
||||
{
|
||||
NewExpression newExpression = this.VisitNew(init.NewExpression);
|
||||
IEnumerable<MemberBinding> enumerable = this.VisitBindingList(init.Bindings);
|
||||
if (newExpression != init.NewExpression || enumerable != init.Bindings)
|
||||
{
|
||||
return Expression.MemberInit(newExpression, enumerable);
|
||||
}
|
||||
return init;
|
||||
}
|
||||
|
||||
// Token: 0x060001E2 RID: 482 RVA: 0x0000AFC0 File Offset: 0x000091C0
|
||||
protected virtual Expression VisitListInit(ListInitExpression init)
|
||||
{
|
||||
NewExpression newExpression = this.VisitNew(init.NewExpression);
|
||||
IEnumerable<ElementInit> enumerable = this.VisitElementInitializerList(init.Initializers);
|
||||
if (newExpression != init.NewExpression || enumerable != init.Initializers)
|
||||
{
|
||||
return Expression.ListInit(newExpression, enumerable);
|
||||
}
|
||||
return init;
|
||||
}
|
||||
|
||||
// Token: 0x060001E3 RID: 483 RVA: 0x0000B008 File Offset: 0x00009208
|
||||
protected virtual Expression VisitNewArray(NewArrayExpression na)
|
||||
{
|
||||
IEnumerable<Expression> enumerable = this.VisitExpressionList(na.Expressions);
|
||||
if (enumerable == na.Expressions)
|
||||
{
|
||||
return na;
|
||||
}
|
||||
if (na.NodeType == ExpressionType.NewArrayInit)
|
||||
{
|
||||
return Expression.NewArrayInit(na.Type.GetElementType(), enumerable);
|
||||
}
|
||||
return Expression.NewArrayBounds(na.Type.GetElementType(), enumerable);
|
||||
}
|
||||
|
||||
// Token: 0x060001E4 RID: 484 RVA: 0x0000B060 File Offset: 0x00009260
|
||||
protected virtual Expression VisitInvocation(InvocationExpression iv)
|
||||
{
|
||||
IEnumerable<Expression> enumerable = this.VisitExpressionList(iv.Arguments);
|
||||
Expression expression = this.Visit(iv.Expression);
|
||||
if (enumerable != iv.Arguments || expression != iv.Expression)
|
||||
{
|
||||
return Expression.Invoke(expression, enumerable);
|
||||
}
|
||||
return iv;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
using System;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Describes the node types for the nodes of an expression tree.</summary>
|
||||
// Token: 0x0200001F RID: 31
|
||||
public enum ExpressionType
|
||||
{
|
||||
/// <summary>A node that represents arithmetic addition without overflow checking.</summary>
|
||||
// Token: 0x04000077 RID: 119
|
||||
Add,
|
||||
/// <summary>A node that represents arithmetic addition with overflow checking.</summary>
|
||||
// Token: 0x04000078 RID: 120
|
||||
AddChecked,
|
||||
/// <summary>A node that represents a bitwise AND operation.</summary>
|
||||
// Token: 0x04000079 RID: 121
|
||||
And,
|
||||
/// <summary>A node that represents a short-circuiting conditional AND operation.</summary>
|
||||
// Token: 0x0400007A RID: 122
|
||||
AndAlso,
|
||||
/// <summary>A node that represents getting the length of a one-dimensional array.</summary>
|
||||
// Token: 0x0400007B RID: 123
|
||||
ArrayLength,
|
||||
/// <summary>A node that represents indexing into a one-dimensional array.</summary>
|
||||
// Token: 0x0400007C RID: 124
|
||||
ArrayIndex,
|
||||
/// <summary>A node that represents a method call.</summary>
|
||||
// Token: 0x0400007D RID: 125
|
||||
Call,
|
||||
/// <summary>A node that represents a null coalescing operation.</summary>
|
||||
// Token: 0x0400007E RID: 126
|
||||
Coalesce,
|
||||
/// <summary>A node that represents a conditional operation.</summary>
|
||||
// Token: 0x0400007F RID: 127
|
||||
Conditional,
|
||||
/// <summary>A node that represents an expression that has a constant value.</summary>
|
||||
// Token: 0x04000080 RID: 128
|
||||
Constant,
|
||||
/// <summary>A node that represents a cast or conversion operation. If the operation is a numeric conversion, it overflows silently if the converted value does not fit the target type.</summary>
|
||||
// Token: 0x04000081 RID: 129
|
||||
Convert,
|
||||
/// <summary>A node that represents a cast or conversion operation. If the operation is a numeric conversion, an exception is thrown if the converted value does not fit the target type.</summary>
|
||||
// Token: 0x04000082 RID: 130
|
||||
ConvertChecked,
|
||||
/// <summary>A node that represents arithmetic division.</summary>
|
||||
// Token: 0x04000083 RID: 131
|
||||
Divide,
|
||||
/// <summary>A node that represents an equality comparison.</summary>
|
||||
// Token: 0x04000084 RID: 132
|
||||
Equal,
|
||||
/// <summary>A node that represents a bitwise XOR operation.</summary>
|
||||
// Token: 0x04000085 RID: 133
|
||||
ExclusiveOr,
|
||||
/// <summary>A node that represents a "greater than" numeric comparison.</summary>
|
||||
// Token: 0x04000086 RID: 134
|
||||
GreaterThan,
|
||||
/// <summary>A node that represents a "greater than or equal" numeric comparison.</summary>
|
||||
// Token: 0x04000087 RID: 135
|
||||
GreaterThanOrEqual,
|
||||
/// <summary>A node that represents applying a delegate or lambda expression to a list of argument expressions.</summary>
|
||||
// Token: 0x04000088 RID: 136
|
||||
Invoke,
|
||||
/// <summary>A node that represents a lambda expression.</summary>
|
||||
// Token: 0x04000089 RID: 137
|
||||
Lambda,
|
||||
/// <summary>A node that represents a bitwise left-shift operation.</summary>
|
||||
// Token: 0x0400008A RID: 138
|
||||
LeftShift,
|
||||
/// <summary>A node that represents a "less than" numeric comparison.</summary>
|
||||
// Token: 0x0400008B RID: 139
|
||||
LessThan,
|
||||
/// <summary>A node that represents a "less than or equal" numeric comparison.</summary>
|
||||
// Token: 0x0400008C RID: 140
|
||||
LessThanOrEqual,
|
||||
/// <summary>A node that represents creating a new <see cref="T:System.Collections.IEnumerable" /> object and initializing it from a list of elements.</summary>
|
||||
// Token: 0x0400008D RID: 141
|
||||
ListInit,
|
||||
/// <summary>A node that represents reading from a field or property.</summary>
|
||||
// Token: 0x0400008E RID: 142
|
||||
MemberAccess,
|
||||
/// <summary>A node that represents creating a new object and initializing one or more of its members.</summary>
|
||||
// Token: 0x0400008F RID: 143
|
||||
MemberInit,
|
||||
/// <summary>A node that represents an arithmetic remainder operation.</summary>
|
||||
// Token: 0x04000090 RID: 144
|
||||
Modulo,
|
||||
/// <summary>A node that represents arithmetic multiplication without overflow checking.</summary>
|
||||
// Token: 0x04000091 RID: 145
|
||||
Multiply,
|
||||
/// <summary>A node that represents arithmetic multiplication with overflow checking.</summary>
|
||||
// Token: 0x04000092 RID: 146
|
||||
MultiplyChecked,
|
||||
/// <summary>A node that represents an arithmetic negation operation.</summary>
|
||||
// Token: 0x04000093 RID: 147
|
||||
Negate,
|
||||
/// <summary>A node that represents a unary plus operation. The result of a predefined unary plus operation is simply the value of the operand, but user-defined implementations may have non-trivial results.</summary>
|
||||
// Token: 0x04000094 RID: 148
|
||||
UnaryPlus,
|
||||
/// <summary>A node that represents an arithmetic negation operation that has overflow checking.</summary>
|
||||
// Token: 0x04000095 RID: 149
|
||||
NegateChecked,
|
||||
/// <summary>A node that represents calling a constructor to create a new object.</summary>
|
||||
// Token: 0x04000096 RID: 150
|
||||
New,
|
||||
/// <summary>A node that represents creating a new one-dimensional array and initializing it from a list of elements.</summary>
|
||||
// Token: 0x04000097 RID: 151
|
||||
NewArrayInit,
|
||||
/// <summary>A node that represents creating a new array where the bounds for each dimension are specified.</summary>
|
||||
// Token: 0x04000098 RID: 152
|
||||
NewArrayBounds,
|
||||
/// <summary>A node that represents a bitwise complement operation.</summary>
|
||||
// Token: 0x04000099 RID: 153
|
||||
Not,
|
||||
/// <summary>A node that represents an inequality comparison.</summary>
|
||||
// Token: 0x0400009A RID: 154
|
||||
NotEqual,
|
||||
/// <summary>A node that represents a bitwise OR operation.</summary>
|
||||
// Token: 0x0400009B RID: 155
|
||||
Or,
|
||||
/// <summary>A node that represents a short-circuiting conditional OR operation.</summary>
|
||||
// Token: 0x0400009C RID: 156
|
||||
OrElse,
|
||||
/// <summary>A node that represents a reference to a parameter defined in the context of the expression.</summary>
|
||||
// Token: 0x0400009D RID: 157
|
||||
Parameter,
|
||||
/// <summary>A node that represents raising a number to a power.</summary>
|
||||
// Token: 0x0400009E RID: 158
|
||||
Power,
|
||||
/// <summary>A node that represents an expression that has a constant value of type <see cref="T:System.Linq.Expressions.Expression" />. A <see cref="F:System.Linq.Expressions.ExpressionType.Quote" /> node can contain references to parameters defined in the context of the expression it represents.</summary>
|
||||
// Token: 0x0400009F RID: 159
|
||||
Quote,
|
||||
/// <summary>A node that represents a bitwise right-shift operation.</summary>
|
||||
// Token: 0x040000A0 RID: 160
|
||||
RightShift,
|
||||
/// <summary>A node that represents arithmetic subtraction without overflow checking.</summary>
|
||||
// Token: 0x040000A1 RID: 161
|
||||
Subtract,
|
||||
/// <summary>A node that represents arithmetic subtraction with overflow checking.</summary>
|
||||
// Token: 0x040000A2 RID: 162
|
||||
SubtractChecked,
|
||||
/// <summary>A node that represents an explicit reference or boxing conversion where null is supplied if the conversion fails.</summary>
|
||||
// Token: 0x040000A3 RID: 163
|
||||
TypeAs,
|
||||
/// <summary>A node that represents a type test.</summary>
|
||||
// Token: 0x040000A4 RID: 164
|
||||
TypeIs
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
// Token: 0x02000020 RID: 32
|
||||
internal abstract class ExpressionVisitor
|
||||
{
|
||||
// Token: 0x060001E6 RID: 486 RVA: 0x0000B0B0 File Offset: 0x000092B0
|
||||
protected virtual void Visit(Expression expression)
|
||||
{
|
||||
if (expression == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (expression.NodeType)
|
||||
{
|
||||
case ExpressionType.Add:
|
||||
case ExpressionType.AddChecked:
|
||||
case ExpressionType.And:
|
||||
case ExpressionType.AndAlso:
|
||||
case ExpressionType.ArrayIndex:
|
||||
case ExpressionType.Coalesce:
|
||||
case ExpressionType.Divide:
|
||||
case ExpressionType.Equal:
|
||||
case ExpressionType.ExclusiveOr:
|
||||
case ExpressionType.GreaterThan:
|
||||
case ExpressionType.GreaterThanOrEqual:
|
||||
case ExpressionType.LeftShift:
|
||||
case ExpressionType.LessThan:
|
||||
case ExpressionType.LessThanOrEqual:
|
||||
case ExpressionType.Modulo:
|
||||
case ExpressionType.Multiply:
|
||||
case ExpressionType.MultiplyChecked:
|
||||
case ExpressionType.NotEqual:
|
||||
case ExpressionType.Or:
|
||||
case ExpressionType.OrElse:
|
||||
case ExpressionType.Power:
|
||||
case ExpressionType.RightShift:
|
||||
case ExpressionType.Subtract:
|
||||
case ExpressionType.SubtractChecked:
|
||||
this.VisitBinary((BinaryExpression)expression);
|
||||
break;
|
||||
case ExpressionType.ArrayLength:
|
||||
case ExpressionType.Convert:
|
||||
case ExpressionType.ConvertChecked:
|
||||
case ExpressionType.Negate:
|
||||
case ExpressionType.UnaryPlus:
|
||||
case ExpressionType.NegateChecked:
|
||||
case ExpressionType.Not:
|
||||
case ExpressionType.Quote:
|
||||
case ExpressionType.TypeAs:
|
||||
this.VisitUnary((UnaryExpression)expression);
|
||||
break;
|
||||
case ExpressionType.Call:
|
||||
this.VisitMethodCall((MethodCallExpression)expression);
|
||||
break;
|
||||
case ExpressionType.Conditional:
|
||||
this.VisitConditional((ConditionalExpression)expression);
|
||||
break;
|
||||
case ExpressionType.Constant:
|
||||
this.VisitConstant((ConstantExpression)expression);
|
||||
break;
|
||||
case ExpressionType.Invoke:
|
||||
this.VisitInvocation((InvocationExpression)expression);
|
||||
break;
|
||||
case ExpressionType.Lambda:
|
||||
this.VisitLambda((LambdaExpression)expression);
|
||||
break;
|
||||
case ExpressionType.ListInit:
|
||||
this.VisitListInit((ListInitExpression)expression);
|
||||
break;
|
||||
case ExpressionType.MemberAccess:
|
||||
this.VisitMemberAccess((MemberExpression)expression);
|
||||
break;
|
||||
case ExpressionType.MemberInit:
|
||||
this.VisitMemberInit((MemberInitExpression)expression);
|
||||
break;
|
||||
case ExpressionType.New:
|
||||
this.VisitNew((NewExpression)expression);
|
||||
break;
|
||||
case ExpressionType.NewArrayInit:
|
||||
case ExpressionType.NewArrayBounds:
|
||||
this.VisitNewArray((NewArrayExpression)expression);
|
||||
break;
|
||||
case ExpressionType.Parameter:
|
||||
this.VisitParameter((ParameterExpression)expression);
|
||||
break;
|
||||
case ExpressionType.TypeIs:
|
||||
this.VisitTypeIs((TypeBinaryExpression)expression);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException(string.Format("Unhandled expression type: '{0}'", expression.NodeType));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001E7 RID: 487 RVA: 0x0000B298 File Offset: 0x00009498
|
||||
protected virtual void VisitBinding(MemberBinding binding)
|
||||
{
|
||||
switch (binding.BindingType)
|
||||
{
|
||||
case MemberBindingType.Assignment:
|
||||
this.VisitMemberAssignment((MemberAssignment)binding);
|
||||
break;
|
||||
case MemberBindingType.MemberBinding:
|
||||
this.VisitMemberMemberBinding((MemberMemberBinding)binding);
|
||||
break;
|
||||
case MemberBindingType.ListBinding:
|
||||
this.VisitMemberListBinding((MemberListBinding)binding);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException(string.Format("Unhandled binding type '{0}'", binding.BindingType));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001E8 RID: 488 RVA: 0x0000B314 File Offset: 0x00009514
|
||||
protected virtual void VisitElementInitializer(ElementInit initializer)
|
||||
{
|
||||
this.VisitExpressionList(initializer.Arguments);
|
||||
}
|
||||
|
||||
// Token: 0x060001E9 RID: 489 RVA: 0x0000B324 File Offset: 0x00009524
|
||||
protected virtual void VisitUnary(UnaryExpression unary)
|
||||
{
|
||||
this.Visit(unary.Operand);
|
||||
}
|
||||
|
||||
// Token: 0x060001EA RID: 490 RVA: 0x0000B334 File Offset: 0x00009534
|
||||
protected virtual void VisitBinary(BinaryExpression binary)
|
||||
{
|
||||
this.Visit(binary.Left);
|
||||
this.Visit(binary.Right);
|
||||
this.Visit(binary.Conversion);
|
||||
}
|
||||
|
||||
// Token: 0x060001EB RID: 491 RVA: 0x0000B368 File Offset: 0x00009568
|
||||
protected virtual void VisitTypeIs(TypeBinaryExpression type)
|
||||
{
|
||||
this.Visit(type.Expression);
|
||||
}
|
||||
|
||||
// Token: 0x060001EC RID: 492 RVA: 0x0000B378 File Offset: 0x00009578
|
||||
protected virtual void VisitConstant(ConstantExpression constant)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060001ED RID: 493 RVA: 0x0000B37C File Offset: 0x0000957C
|
||||
protected virtual void VisitConditional(ConditionalExpression conditional)
|
||||
{
|
||||
this.Visit(conditional.Test);
|
||||
this.Visit(conditional.IfTrue);
|
||||
this.Visit(conditional.IfFalse);
|
||||
}
|
||||
|
||||
// Token: 0x060001EE RID: 494 RVA: 0x0000B3B0 File Offset: 0x000095B0
|
||||
protected virtual void VisitParameter(ParameterExpression parameter)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060001EF RID: 495 RVA: 0x0000B3B4 File Offset: 0x000095B4
|
||||
protected virtual void VisitMemberAccess(MemberExpression member)
|
||||
{
|
||||
this.Visit(member.Expression);
|
||||
}
|
||||
|
||||
// Token: 0x060001F0 RID: 496 RVA: 0x0000B3C4 File Offset: 0x000095C4
|
||||
protected virtual void VisitMethodCall(MethodCallExpression methodCall)
|
||||
{
|
||||
this.Visit(methodCall.Object);
|
||||
this.VisitExpressionList(methodCall.Arguments);
|
||||
}
|
||||
|
||||
// Token: 0x060001F1 RID: 497 RVA: 0x0000B3EC File Offset: 0x000095EC
|
||||
protected virtual void VisitList<T>(ReadOnlyCollection<T> list, Action<T> visitor)
|
||||
{
|
||||
foreach (T t in list)
|
||||
{
|
||||
visitor(t);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001F2 RID: 498 RVA: 0x0000B44C File Offset: 0x0000964C
|
||||
protected virtual void VisitExpressionList(ReadOnlyCollection<Expression> list)
|
||||
{
|
||||
this.VisitList<Expression>(list, new Action<Expression>(this.Visit));
|
||||
}
|
||||
|
||||
// Token: 0x060001F3 RID: 499 RVA: 0x0000B464 File Offset: 0x00009664
|
||||
protected virtual void VisitMemberAssignment(MemberAssignment assignment)
|
||||
{
|
||||
this.Visit(assignment.Expression);
|
||||
}
|
||||
|
||||
// Token: 0x060001F4 RID: 500 RVA: 0x0000B474 File Offset: 0x00009674
|
||||
protected virtual void VisitMemberMemberBinding(MemberMemberBinding binding)
|
||||
{
|
||||
this.VisitBindingList(binding.Bindings);
|
||||
}
|
||||
|
||||
// Token: 0x060001F5 RID: 501 RVA: 0x0000B484 File Offset: 0x00009684
|
||||
protected virtual void VisitMemberListBinding(MemberListBinding binding)
|
||||
{
|
||||
this.VisitElementInitializerList(binding.Initializers);
|
||||
}
|
||||
|
||||
// Token: 0x060001F6 RID: 502 RVA: 0x0000B494 File Offset: 0x00009694
|
||||
protected virtual void VisitBindingList(ReadOnlyCollection<MemberBinding> list)
|
||||
{
|
||||
this.VisitList<MemberBinding>(list, new Action<MemberBinding>(this.VisitBinding));
|
||||
}
|
||||
|
||||
// Token: 0x060001F7 RID: 503 RVA: 0x0000B4AC File Offset: 0x000096AC
|
||||
protected virtual void VisitElementInitializerList(ReadOnlyCollection<ElementInit> list)
|
||||
{
|
||||
this.VisitList<ElementInit>(list, new Action<ElementInit>(this.VisitElementInitializer));
|
||||
}
|
||||
|
||||
// Token: 0x060001F8 RID: 504 RVA: 0x0000B4C4 File Offset: 0x000096C4
|
||||
protected virtual void VisitLambda(LambdaExpression lambda)
|
||||
{
|
||||
this.Visit(lambda.Body);
|
||||
}
|
||||
|
||||
// Token: 0x060001F9 RID: 505 RVA: 0x0000B4D4 File Offset: 0x000096D4
|
||||
protected virtual void VisitNew(NewExpression nex)
|
||||
{
|
||||
this.VisitExpressionList(nex.Arguments);
|
||||
}
|
||||
|
||||
// Token: 0x060001FA RID: 506 RVA: 0x0000B4E4 File Offset: 0x000096E4
|
||||
protected virtual void VisitMemberInit(MemberInitExpression init)
|
||||
{
|
||||
this.VisitNew(init.NewExpression);
|
||||
this.VisitBindingList(init.Bindings);
|
||||
}
|
||||
|
||||
// Token: 0x060001FB RID: 507 RVA: 0x0000B50C File Offset: 0x0000970C
|
||||
protected virtual void VisitListInit(ListInitExpression init)
|
||||
{
|
||||
this.VisitNew(init.NewExpression);
|
||||
this.VisitElementInitializerList(init.Initializers);
|
||||
}
|
||||
|
||||
// Token: 0x060001FC RID: 508 RVA: 0x0000B534 File Offset: 0x00009734
|
||||
protected virtual void VisitNewArray(NewArrayExpression newArray)
|
||||
{
|
||||
this.VisitExpressionList(newArray.Expressions);
|
||||
}
|
||||
|
||||
// Token: 0x060001FD RID: 509 RVA: 0x0000B544 File Offset: 0x00009744
|
||||
protected virtual void VisitInvocation(InvocationExpression invocation)
|
||||
{
|
||||
this.VisitExpressionList(invocation.Arguments);
|
||||
this.Visit(invocation.Expression);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
// Token: 0x02000021 RID: 33
|
||||
internal static class Extensions
|
||||
{
|
||||
// Token: 0x060001FE RID: 510 RVA: 0x0000B56C File Offset: 0x0000976C
|
||||
public static bool IsGenericInstanceOf(this Type self, Type type)
|
||||
{
|
||||
return self.IsGenericType && self.GetGenericTypeDefinition() == type;
|
||||
}
|
||||
|
||||
// Token: 0x060001FF RID: 511 RVA: 0x0000B584 File Offset: 0x00009784
|
||||
public static bool IsNullable(this Type self)
|
||||
{
|
||||
return self.IsValueType && self.IsGenericInstanceOf(typeof(Nullable<>));
|
||||
}
|
||||
|
||||
// Token: 0x06000200 RID: 512 RVA: 0x0000B5A4 File Offset: 0x000097A4
|
||||
public static bool IsExpression(this Type self)
|
||||
{
|
||||
return self == typeof(Expression) || self.IsSubclassOf(typeof(Expression));
|
||||
}
|
||||
|
||||
// Token: 0x06000201 RID: 513 RVA: 0x0000B5CC File Offset: 0x000097CC
|
||||
public static bool IsGenericImplementationOf(this Type self, Type type)
|
||||
{
|
||||
foreach (Type type2 in self.GetInterfaces())
|
||||
{
|
||||
if (type2.IsGenericInstanceOf(type))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x06000202 RID: 514 RVA: 0x0000B608 File Offset: 0x00009808
|
||||
public static bool IsAssignableTo(this Type self, Type type)
|
||||
{
|
||||
return type.IsAssignableFrom(self) || Extensions.ArrayTypeIsAssignableTo(self, type);
|
||||
}
|
||||
|
||||
// Token: 0x06000203 RID: 515 RVA: 0x0000B620 File Offset: 0x00009820
|
||||
public static Type GetFirstGenericArgument(this Type self)
|
||||
{
|
||||
return self.GetGenericArguments()[0];
|
||||
}
|
||||
|
||||
// Token: 0x06000204 RID: 516 RVA: 0x0000B62C File Offset: 0x0000982C
|
||||
public static Type MakeGenericTypeFrom(this Type self, Type type)
|
||||
{
|
||||
return self.MakeGenericType(type.GetGenericArguments());
|
||||
}
|
||||
|
||||
// Token: 0x06000205 RID: 517 RVA: 0x0000B63C File Offset: 0x0000983C
|
||||
public static Type MakeNullableType(this Type self)
|
||||
{
|
||||
return typeof(Nullable<>).MakeGenericType(new Type[] { self });
|
||||
}
|
||||
|
||||
// Token: 0x06000206 RID: 518 RVA: 0x0000B658 File Offset: 0x00009858
|
||||
public static Type GetNotNullableType(this Type self)
|
||||
{
|
||||
return (!self.IsNullable()) ? self : self.GetFirstGenericArgument();
|
||||
}
|
||||
|
||||
// Token: 0x06000207 RID: 519 RVA: 0x0000B674 File Offset: 0x00009874
|
||||
public static MethodInfo GetInvokeMethod(this Type self)
|
||||
{
|
||||
return self.GetMethod("Invoke", BindingFlags.Instance | BindingFlags.Public);
|
||||
}
|
||||
|
||||
// Token: 0x06000208 RID: 520 RVA: 0x0000B684 File Offset: 0x00009884
|
||||
public static MethodInfo MakeGenericMethodFrom(this MethodInfo self, MethodInfo method)
|
||||
{
|
||||
return self.MakeGenericMethod(method.GetGenericArguments());
|
||||
}
|
||||
|
||||
// Token: 0x06000209 RID: 521 RVA: 0x0000B694 File Offset: 0x00009894
|
||||
public static Type[] GetParameterTypes(this MethodBase self)
|
||||
{
|
||||
ParameterInfo[] parameters = self.GetParameters();
|
||||
Type[] array = new Type[parameters.Length];
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
array[i] = parameters[i].ParameterType;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x0600020A RID: 522 RVA: 0x0000B6D4 File Offset: 0x000098D4
|
||||
private static bool ArrayTypeIsAssignableTo(Type type, Type candidate)
|
||||
{
|
||||
return type.IsArray && candidate.IsArray && type.GetArrayRank() == candidate.GetArrayRank() && type.GetElementType().IsAssignableTo(candidate.GetElementType());
|
||||
}
|
||||
|
||||
// Token: 0x0600020B RID: 523 RVA: 0x0000B720 File Offset: 0x00009920
|
||||
public static void OnFieldOrProperty(this MemberInfo self, Action<FieldInfo> onfield, Action<PropertyInfo> onprop)
|
||||
{
|
||||
MemberTypes memberType = self.MemberType;
|
||||
if (memberType == MemberTypes.Field)
|
||||
{
|
||||
onfield((FieldInfo)self);
|
||||
return;
|
||||
}
|
||||
if (memberType != MemberTypes.Property)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
onprop((PropertyInfo)self);
|
||||
}
|
||||
|
||||
// Token: 0x0600020C RID: 524 RVA: 0x0000B768 File Offset: 0x00009968
|
||||
public static T OnFieldOrProperty<T>(this MemberInfo self, Func<FieldInfo, T> onfield, Func<PropertyInfo, T> onprop)
|
||||
{
|
||||
MemberTypes memberType = self.MemberType;
|
||||
if (memberType == MemberTypes.Field)
|
||||
{
|
||||
return onfield((FieldInfo)self);
|
||||
}
|
||||
if (memberType != MemberTypes.Property)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
return onprop((PropertyInfo)self);
|
||||
}
|
||||
|
||||
// Token: 0x0600020D RID: 525 RVA: 0x0000B7B0 File Offset: 0x000099B0
|
||||
public static Type MakeStrongBoxType(this Type self)
|
||||
{
|
||||
return typeof(StrongBox<>).MakeGenericType(new Type[] { self });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents an expression that applies a delegate or lambda expression to a list of argument expressions.</summary>
|
||||
// Token: 0x02000022 RID: 34
|
||||
public sealed class InvocationExpression : Expression
|
||||
{
|
||||
// Token: 0x0600020E RID: 526 RVA: 0x0000B7CC File Offset: 0x000099CC
|
||||
internal InvocationExpression(Expression expression, Type type, ReadOnlyCollection<Expression> arguments)
|
||||
: base(ExpressionType.Invoke, type)
|
||||
{
|
||||
this.expression = expression;
|
||||
this.arguments = arguments;
|
||||
}
|
||||
|
||||
/// <summary>Gets the delegate or lambda expression to be applied.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the delegate to be applied.</returns>
|
||||
// Token: 0x1700001F RID: 31
|
||||
// (get) Token: 0x0600020F RID: 527 RVA: 0x0000B7E8 File Offset: 0x000099E8
|
||||
public Expression Expression
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.expression;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the arguments that the delegate is applied to.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.Expression" /> objects which represent the arguments that the delegate is applied to.</returns>
|
||||
// Token: 0x17000020 RID: 32
|
||||
// (get) Token: 0x06000210 RID: 528 RVA: 0x0000B7F0 File Offset: 0x000099F0
|
||||
public ReadOnlyCollection<Expression> Arguments
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.arguments;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000211 RID: 529 RVA: 0x0000B7F8 File Offset: 0x000099F8
|
||||
internal override void Emit(EmitContext ec)
|
||||
{
|
||||
ec.EmitCall(this.expression, this.arguments, this.expression.Type.GetInvokeMethod());
|
||||
}
|
||||
|
||||
// Token: 0x040000A5 RID: 165
|
||||
private Expression expression;
|
||||
|
||||
// Token: 0x040000A6 RID: 166
|
||||
private ReadOnlyCollection<Expression> arguments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Describes a lambda expression.</summary>
|
||||
// Token: 0x02000004 RID: 4
|
||||
public class LambdaExpression : Expression
|
||||
{
|
||||
// Token: 0x06000004 RID: 4 RVA: 0x00002118 File Offset: 0x00000318
|
||||
internal LambdaExpression(Type delegateType, Expression body, ReadOnlyCollection<ParameterExpression> parameters)
|
||||
: base(ExpressionType.Lambda, delegateType)
|
||||
{
|
||||
this.body = body;
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
/// <summary>Gets the body of the lambda expression.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the body of the lambda expression.</returns>
|
||||
// Token: 0x17000001 RID: 1
|
||||
// (get) Token: 0x06000005 RID: 5 RVA: 0x00002134 File Offset: 0x00000334
|
||||
public Expression Body
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.body;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the parameters of the lambda expression.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.ParameterExpression" /> objects that represent the parameters of the lambda expression.</returns>
|
||||
// Token: 0x17000002 RID: 2
|
||||
// (get) Token: 0x06000006 RID: 6 RVA: 0x0000213C File Offset: 0x0000033C
|
||||
public ReadOnlyCollection<ParameterExpression> Parameters
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.parameters;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000007 RID: 7 RVA: 0x00002144 File Offset: 0x00000344
|
||||
private void EmitPopIfNeeded(EmitContext ec)
|
||||
{
|
||||
if (this.GetReturnType() == typeof(void) && this.body.Type != typeof(void))
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Pop);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000008 RID: 8 RVA: 0x00002190 File Offset: 0x00000390
|
||||
internal override void Emit(EmitContext ec)
|
||||
{
|
||||
ec.EmitCreateDelegate(this);
|
||||
}
|
||||
|
||||
// Token: 0x06000009 RID: 9 RVA: 0x0000219C File Offset: 0x0000039C
|
||||
internal void EmitBody(EmitContext ec)
|
||||
{
|
||||
this.body.Emit(ec);
|
||||
this.EmitPopIfNeeded(ec);
|
||||
ec.ig.Emit(OpCodes.Ret);
|
||||
}
|
||||
|
||||
// Token: 0x0600000A RID: 10 RVA: 0x000021C4 File Offset: 0x000003C4
|
||||
internal Type GetReturnType()
|
||||
{
|
||||
return base.Type.GetInvokeMethod().ReturnType;
|
||||
}
|
||||
|
||||
/// <summary>Produces a delegate that represents the lambda expression.</summary>
|
||||
/// <returns>A <see cref="T:System.Delegate" /> that, when it is executed, has the behavior described by the semantics of the <see cref="T:System.Linq.Expressions.LambdaExpression" />.</returns>
|
||||
// Token: 0x0600000B RID: 11 RVA: 0x000021D8 File Offset: 0x000003D8
|
||||
public Delegate Compile()
|
||||
{
|
||||
CompilationContext compilationContext = new CompilationContext();
|
||||
compilationContext.AddCompilationUnit(this);
|
||||
return compilationContext.CreateDelegate();
|
||||
}
|
||||
|
||||
// Token: 0x04000001 RID: 1
|
||||
private Expression body;
|
||||
|
||||
// Token: 0x04000002 RID: 2
|
||||
private ReadOnlyCollection<ParameterExpression> parameters;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents a constructor call that has a collection initializer.</summary>
|
||||
// Token: 0x02000023 RID: 35
|
||||
public sealed class ListInitExpression : Expression
|
||||
{
|
||||
// Token: 0x06000212 RID: 530 RVA: 0x0000B828 File Offset: 0x00009A28
|
||||
internal ListInitExpression(NewExpression new_expression, ReadOnlyCollection<ElementInit> initializers)
|
||||
: base(ExpressionType.ListInit, new_expression.Type)
|
||||
{
|
||||
this.new_expression = new_expression;
|
||||
this.initializers = initializers;
|
||||
}
|
||||
|
||||
/// <summary>Gets the expression that contains a call to the constructor of a collection type.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that represents the call to the constructor of a collection type.</returns>
|
||||
// Token: 0x17000021 RID: 33
|
||||
// (get) Token: 0x06000213 RID: 531 RVA: 0x0000B848 File Offset: 0x00009A48
|
||||
public NewExpression NewExpression
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.new_expression;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the element initializers that are used to initialize a collection.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.ElementInit" /> objects which represent the elements that are used to initialize the collection.</returns>
|
||||
// Token: 0x17000022 RID: 34
|
||||
// (get) Token: 0x06000214 RID: 532 RVA: 0x0000B850 File Offset: 0x00009A50
|
||||
public ReadOnlyCollection<ElementInit> Initializers
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.initializers;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000215 RID: 533 RVA: 0x0000B858 File Offset: 0x00009A58
|
||||
internal override void Emit(EmitContext ec)
|
||||
{
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.new_expression);
|
||||
ec.EmitCollection(this.initializers, localBuilder);
|
||||
ec.EmitLoad(localBuilder);
|
||||
}
|
||||
|
||||
// Token: 0x040000A7 RID: 167
|
||||
private NewExpression new_expression;
|
||||
|
||||
// Token: 0x040000A8 RID: 168
|
||||
private ReadOnlyCollection<ElementInit> initializers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents initializing a field or property of a newly created object.</summary>
|
||||
// Token: 0x02000024 RID: 36
|
||||
public sealed class MemberAssignment : MemberBinding
|
||||
{
|
||||
// Token: 0x06000216 RID: 534 RVA: 0x0000B888 File Offset: 0x00009A88
|
||||
internal MemberAssignment(MemberInfo member, Expression expression)
|
||||
: base(MemberBindingType.Assignment, member)
|
||||
{
|
||||
this.expression = expression;
|
||||
}
|
||||
|
||||
/// <summary>Gets the expression to assign to the field or property.</summary>
|
||||
/// <returns>The <see cref="T:System.Linq.Expressions.Expression" /> that represents the value to assign to the field or property.</returns>
|
||||
// Token: 0x17000023 RID: 35
|
||||
// (get) Token: 0x06000217 RID: 535 RVA: 0x0000B89C File Offset: 0x00009A9C
|
||||
public Expression Expression
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.expression;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000218 RID: 536 RVA: 0x0000B8A4 File Offset: 0x00009AA4
|
||||
internal override void Emit(EmitContext ec, LocalBuilder local)
|
||||
{
|
||||
base.Member.OnFieldOrProperty(delegate(FieldInfo field)
|
||||
{
|
||||
this.EmitFieldAssignment(ec, field, local);
|
||||
}, delegate(PropertyInfo prop)
|
||||
{
|
||||
this.EmitPropertyAssignment(ec, prop, local);
|
||||
});
|
||||
}
|
||||
|
||||
// Token: 0x06000219 RID: 537 RVA: 0x0000B8F0 File Offset: 0x00009AF0
|
||||
private void EmitFieldAssignment(EmitContext ec, FieldInfo field, LocalBuilder local)
|
||||
{
|
||||
ec.EmitLoadSubject(local);
|
||||
this.expression.Emit(ec);
|
||||
ec.ig.Emit(OpCodes.Stfld, field);
|
||||
}
|
||||
|
||||
// Token: 0x0600021A RID: 538 RVA: 0x0000B924 File Offset: 0x00009B24
|
||||
private void EmitPropertyAssignment(EmitContext ec, PropertyInfo property, LocalBuilder local)
|
||||
{
|
||||
MethodInfo setMethod = property.GetSetMethod(true);
|
||||
if (setMethod == null)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
ec.EmitLoadSubject(local);
|
||||
this.expression.Emit(ec);
|
||||
ec.EmitCall(setMethod);
|
||||
}
|
||||
|
||||
// Token: 0x040000A9 RID: 169
|
||||
private Expression expression;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Provides the base class from which the classes that represent bindings that are used to initialize members of a newly created object derive.</summary>
|
||||
// Token: 0x02000025 RID: 37
|
||||
public abstract class MemberBinding
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Linq.Expressions.MemberBinding" /> class.</summary>
|
||||
/// <param name="type">The <see cref="T:System.Linq.Expressions.MemberBindingType" /> that discriminates the type of binding that is represented.</param>
|
||||
/// <param name="member">The <see cref="T:System.Reflection.MemberInfo" /> that represents a field or property to be initialized.</param>
|
||||
// Token: 0x0600021B RID: 539 RVA: 0x0000B960 File Offset: 0x00009B60
|
||||
protected MemberBinding(MemberBindingType binding_type, MemberInfo member)
|
||||
{
|
||||
this.binding_type = binding_type;
|
||||
this.member = member;
|
||||
}
|
||||
|
||||
/// <summary>Gets the type of binding that is represented.</summary>
|
||||
/// <returns>One of the <see cref="T:System.Linq.Expressions.MemberBindingType" /> values.</returns>
|
||||
// Token: 0x17000024 RID: 36
|
||||
// (get) Token: 0x0600021C RID: 540 RVA: 0x0000B978 File Offset: 0x00009B78
|
||||
public MemberBindingType BindingType
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.binding_type;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the field or property to be initialized.</summary>
|
||||
/// <returns>The <see cref="T:System.Reflection.MemberInfo" /> that represents the field or property to be initialized.</returns>
|
||||
// Token: 0x17000025 RID: 37
|
||||
// (get) Token: 0x0600021D RID: 541 RVA: 0x0000B980 File Offset: 0x00009B80
|
||||
public MemberInfo Member
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.member;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Returns a textual representation of the <see cref="T:System.Linq.Expressions.MemberBinding" />.</summary>
|
||||
/// <returns>A textual representation of the <see cref="T:System.Linq.Expressions.MemberBinding" />.</returns>
|
||||
// Token: 0x0600021E RID: 542 RVA: 0x0000B988 File Offset: 0x00009B88
|
||||
public override string ToString()
|
||||
{
|
||||
return ExpressionPrinter.ToString(this);
|
||||
}
|
||||
|
||||
// Token: 0x0600021F RID: 543
|
||||
internal abstract void Emit(EmitContext ec, LocalBuilder local);
|
||||
|
||||
// Token: 0x06000220 RID: 544 RVA: 0x0000B990 File Offset: 0x00009B90
|
||||
internal LocalBuilder EmitLoadMember(EmitContext ec, LocalBuilder local)
|
||||
{
|
||||
ec.EmitLoadSubject(local);
|
||||
return this.member.OnFieldOrProperty((FieldInfo field) => this.EmitLoadField(ec, field), (PropertyInfo prop) => this.EmitLoadProperty(ec, prop));
|
||||
}
|
||||
|
||||
// Token: 0x06000221 RID: 545 RVA: 0x0000B9E0 File Offset: 0x00009BE0
|
||||
private LocalBuilder EmitLoadProperty(EmitContext ec, PropertyInfo property)
|
||||
{
|
||||
MethodInfo getMethod = property.GetGetMethod(true);
|
||||
if (getMethod == null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
LocalBuilder localBuilder = ec.ig.DeclareLocal(property.PropertyType);
|
||||
ec.EmitCall(getMethod);
|
||||
ec.ig.Emit(OpCodes.Stloc, localBuilder);
|
||||
return localBuilder;
|
||||
}
|
||||
|
||||
// Token: 0x06000222 RID: 546 RVA: 0x0000BA2C File Offset: 0x00009C2C
|
||||
private LocalBuilder EmitLoadField(EmitContext ec, FieldInfo field)
|
||||
{
|
||||
LocalBuilder localBuilder = ec.ig.DeclareLocal(field.FieldType);
|
||||
ec.ig.Emit(OpCodes.Ldfld, field);
|
||||
ec.ig.Emit(OpCodes.Stloc, localBuilder);
|
||||
return localBuilder;
|
||||
}
|
||||
|
||||
// Token: 0x040000AA RID: 170
|
||||
private MemberBindingType binding_type;
|
||||
|
||||
// Token: 0x040000AB RID: 171
|
||||
private MemberInfo member;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Describes the binding types that are used in <see cref="T:System.Linq.Expressions.MemberInitExpression" /> objects.</summary>
|
||||
// Token: 0x02000026 RID: 38
|
||||
public enum MemberBindingType
|
||||
{
|
||||
/// <summary>A binding that represents initializing a member with the value of an expression.</summary>
|
||||
// Token: 0x040000AD RID: 173
|
||||
Assignment,
|
||||
/// <summary>A binding that represents recursively initializing members of a member.</summary>
|
||||
// Token: 0x040000AE RID: 174
|
||||
MemberBinding,
|
||||
/// <summary>A binding that represents initializing a member of type <see cref="T:System.Collections.IList" /> or <see cref="T:System.Collections.Generic.ICollection`1" /> from a list of elements.</summary>
|
||||
// Token: 0x040000AF RID: 175
|
||||
ListBinding
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents accessing a field or property.</summary>
|
||||
// Token: 0x02000027 RID: 39
|
||||
public sealed class MemberExpression : Expression
|
||||
{
|
||||
// Token: 0x06000223 RID: 547 RVA: 0x0000BA70 File Offset: 0x00009C70
|
||||
internal MemberExpression(Expression expression, MemberInfo member, Type type)
|
||||
: base(ExpressionType.MemberAccess, type)
|
||||
{
|
||||
this.expression = expression;
|
||||
this.member = member;
|
||||
}
|
||||
|
||||
/// <summary>Gets the containing object of the field or property.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the containing object of the field or property.</returns>
|
||||
// Token: 0x17000026 RID: 38
|
||||
// (get) Token: 0x06000224 RID: 548 RVA: 0x0000BA8C File Offset: 0x00009C8C
|
||||
public Expression Expression
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.expression;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the field or property to be accessed.</summary>
|
||||
/// <returns>The <see cref="T:System.Reflection.MemberInfo" /> that represents the field or property to be accessed.</returns>
|
||||
// Token: 0x17000027 RID: 39
|
||||
// (get) Token: 0x06000225 RID: 549 RVA: 0x0000BA94 File Offset: 0x00009C94
|
||||
public MemberInfo Member
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.member;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000226 RID: 550 RVA: 0x0000BA9C File Offset: 0x00009C9C
|
||||
internal override void Emit(EmitContext ec)
|
||||
{
|
||||
this.member.OnFieldOrProperty(delegate(FieldInfo field)
|
||||
{
|
||||
this.EmitFieldAccess(ec, field);
|
||||
}, delegate(PropertyInfo prop)
|
||||
{
|
||||
this.EmitPropertyAccess(ec, prop);
|
||||
});
|
||||
}
|
||||
|
||||
// Token: 0x06000227 RID: 551 RVA: 0x0000BAE0 File Offset: 0x00009CE0
|
||||
private void EmitPropertyAccess(EmitContext ec, PropertyInfo property)
|
||||
{
|
||||
MethodInfo getMethod = property.GetGetMethod(true);
|
||||
if (!getMethod.IsStatic)
|
||||
{
|
||||
ec.EmitLoadSubject(this.expression);
|
||||
}
|
||||
ec.EmitCall(getMethod);
|
||||
}
|
||||
|
||||
// Token: 0x06000228 RID: 552 RVA: 0x0000BB14 File Offset: 0x00009D14
|
||||
private void EmitFieldAccess(EmitContext ec, FieldInfo field)
|
||||
{
|
||||
if (!field.IsStatic)
|
||||
{
|
||||
ec.EmitLoadSubject(this.expression);
|
||||
ec.ig.Emit(OpCodes.Ldfld, field);
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Ldsfld, field);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000B0 RID: 176
|
||||
private Expression expression;
|
||||
|
||||
// Token: 0x040000B1 RID: 177
|
||||
private MemberInfo member;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents calling a constructor and initializing one or more members of the new object.</summary>
|
||||
// Token: 0x02000028 RID: 40
|
||||
public sealed class MemberInitExpression : Expression
|
||||
{
|
||||
// Token: 0x06000229 RID: 553 RVA: 0x0000BB60 File Offset: 0x00009D60
|
||||
internal MemberInitExpression(NewExpression new_expression, ReadOnlyCollection<MemberBinding> bindings)
|
||||
: base(ExpressionType.MemberInit, new_expression.Type)
|
||||
{
|
||||
this.new_expression = new_expression;
|
||||
this.bindings = bindings;
|
||||
}
|
||||
|
||||
/// <summary>Gets the expression that represents the constructor call.</summary>
|
||||
/// <returns>A <see cref="T:System.Linq.Expressions.NewExpression" /> that represents the constructor call.</returns>
|
||||
// Token: 0x17000028 RID: 40
|
||||
// (get) Token: 0x0600022A RID: 554 RVA: 0x0000BB80 File Offset: 0x00009D80
|
||||
public NewExpression NewExpression
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.new_expression;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the bindings that describe how to initialize the members of the newly created object.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.MemberBinding" /> objects which describe how to initialize the members.</returns>
|
||||
// Token: 0x17000029 RID: 41
|
||||
// (get) Token: 0x0600022B RID: 555 RVA: 0x0000BB88 File Offset: 0x00009D88
|
||||
public ReadOnlyCollection<MemberBinding> Bindings
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.bindings;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600022C RID: 556 RVA: 0x0000BB90 File Offset: 0x00009D90
|
||||
internal override void Emit(EmitContext ec)
|
||||
{
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.new_expression);
|
||||
ec.EmitCollection(this.bindings, localBuilder);
|
||||
ec.EmitLoad(localBuilder);
|
||||
}
|
||||
|
||||
// Token: 0x040000B2 RID: 178
|
||||
private NewExpression new_expression;
|
||||
|
||||
// Token: 0x040000B3 RID: 179
|
||||
private ReadOnlyCollection<MemberBinding> bindings;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents initializing the elements of a collection member of a newly created object.</summary>
|
||||
// Token: 0x02000029 RID: 41
|
||||
public sealed class MemberListBinding : MemberBinding
|
||||
{
|
||||
// Token: 0x0600022D RID: 557 RVA: 0x0000BBC0 File Offset: 0x00009DC0
|
||||
internal MemberListBinding(MemberInfo member, ReadOnlyCollection<ElementInit> initializers)
|
||||
: base(MemberBindingType.ListBinding, member)
|
||||
{
|
||||
this.initializers = initializers;
|
||||
}
|
||||
|
||||
/// <summary>Gets the element initializers for initializing a collection member of a newly created object.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.ElementInit" /> objects to initialize a collection member with.</returns>
|
||||
// Token: 0x1700002A RID: 42
|
||||
// (get) Token: 0x0600022E RID: 558 RVA: 0x0000BBD4 File Offset: 0x00009DD4
|
||||
public ReadOnlyCollection<ElementInit> Initializers
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.initializers;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600022F RID: 559 RVA: 0x0000BBDC File Offset: 0x00009DDC
|
||||
internal override void Emit(EmitContext ec, LocalBuilder local)
|
||||
{
|
||||
LocalBuilder localBuilder = base.EmitLoadMember(ec, local);
|
||||
foreach (ElementInit elementInit in this.initializers)
|
||||
{
|
||||
elementInit.Emit(ec, localBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000B4 RID: 180
|
||||
private ReadOnlyCollection<ElementInit> initializers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents initializing members of a member of a newly created object.</summary>
|
||||
// Token: 0x0200002A RID: 42
|
||||
public sealed class MemberMemberBinding : MemberBinding
|
||||
{
|
||||
// Token: 0x06000230 RID: 560 RVA: 0x0000BC4C File Offset: 0x00009E4C
|
||||
internal MemberMemberBinding(MemberInfo member, ReadOnlyCollection<MemberBinding> bindings)
|
||||
: base(MemberBindingType.MemberBinding, member)
|
||||
{
|
||||
this.bindings = bindings;
|
||||
}
|
||||
|
||||
/// <summary>Gets the bindings that describe how to initialize the members of a member.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.MemberBinding" /> objects that describe how to initialize the members of the member.</returns>
|
||||
// Token: 0x1700002B RID: 43
|
||||
// (get) Token: 0x06000231 RID: 561 RVA: 0x0000BC60 File Offset: 0x00009E60
|
||||
public ReadOnlyCollection<MemberBinding> Bindings
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.bindings;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000232 RID: 562 RVA: 0x0000BC68 File Offset: 0x00009E68
|
||||
internal override void Emit(EmitContext ec, LocalBuilder local)
|
||||
{
|
||||
LocalBuilder localBuilder = base.EmitLoadMember(ec, local);
|
||||
foreach (MemberBinding memberBinding in this.bindings)
|
||||
{
|
||||
memberBinding.Emit(ec, localBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000B5 RID: 181
|
||||
private ReadOnlyCollection<MemberBinding> bindings;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents calling a method.</summary>
|
||||
// Token: 0x0200002B RID: 43
|
||||
public sealed class MethodCallExpression : Expression
|
||||
{
|
||||
// Token: 0x06000233 RID: 563 RVA: 0x0000BCD8 File Offset: 0x00009ED8
|
||||
internal MethodCallExpression(MethodInfo method, ReadOnlyCollection<Expression> arguments)
|
||||
: base(ExpressionType.Call, method.ReturnType)
|
||||
{
|
||||
this.method = method;
|
||||
this.arguments = arguments;
|
||||
}
|
||||
|
||||
// Token: 0x06000234 RID: 564 RVA: 0x0000BCF8 File Offset: 0x00009EF8
|
||||
internal MethodCallExpression(Expression obj, MethodInfo method, ReadOnlyCollection<Expression> arguments)
|
||||
: base(ExpressionType.Call, method.ReturnType)
|
||||
{
|
||||
this.obj = obj;
|
||||
this.method = method;
|
||||
this.arguments = arguments;
|
||||
}
|
||||
|
||||
/// <summary>Gets the receiving object of the method.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the receiving object of the method.</returns>
|
||||
// Token: 0x1700002C RID: 44
|
||||
// (get) Token: 0x06000235 RID: 565 RVA: 0x0000BD28 File Offset: 0x00009F28
|
||||
public Expression Object
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.obj;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the called method.</summary>
|
||||
/// <returns>The <see cref="T:System.Reflection.MethodInfo" /> that represents the called method.</returns>
|
||||
// Token: 0x1700002D RID: 45
|
||||
// (get) Token: 0x06000236 RID: 566 RVA: 0x0000BD30 File Offset: 0x00009F30
|
||||
public MethodInfo Method
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.method;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the arguments to the called method.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.Expression" /> objects which represent the arguments to the called method.</returns>
|
||||
// Token: 0x1700002E RID: 46
|
||||
// (get) Token: 0x06000237 RID: 567 RVA: 0x0000BD38 File Offset: 0x00009F38
|
||||
public ReadOnlyCollection<Expression> Arguments
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.arguments;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000238 RID: 568 RVA: 0x0000BD40 File Offset: 0x00009F40
|
||||
internal override void Emit(EmitContext ec)
|
||||
{
|
||||
ec.EmitCall(this.obj, this.arguments, this.method);
|
||||
}
|
||||
|
||||
// Token: 0x040000B6 RID: 182
|
||||
private Expression obj;
|
||||
|
||||
// Token: 0x040000B7 RID: 183
|
||||
private MethodInfo method;
|
||||
|
||||
// Token: 0x040000B8 RID: 184
|
||||
private ReadOnlyCollection<Expression> arguments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents creating a new array and possibly initializing the elements of the new array.</summary>
|
||||
// Token: 0x0200002C RID: 44
|
||||
public sealed class NewArrayExpression : Expression
|
||||
{
|
||||
// Token: 0x06000239 RID: 569 RVA: 0x0000BD5C File Offset: 0x00009F5C
|
||||
internal NewArrayExpression(ExpressionType et, Type type, ReadOnlyCollection<Expression> expressions)
|
||||
: base(et, type)
|
||||
{
|
||||
this.expressions = expressions;
|
||||
}
|
||||
|
||||
/// <summary>Gets the bounds of the array if the value of the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property is <see cref="F:System.Linq.Expressions.ExpressionType.NewArrayBounds" />, or the values to initialize the elements of the new array if the value of the <see cref="P:System.Linq.Expressions.Expression.NodeType" /> property is <see cref="F:System.Linq.Expressions.ExpressionType.NewArrayInit" />.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see cref="T:System.Linq.Expressions.Expression" /> objects which represent either the bounds of the array or the initialization values.</returns>
|
||||
// Token: 0x1700002F RID: 47
|
||||
// (get) Token: 0x0600023A RID: 570 RVA: 0x0000BD70 File Offset: 0x00009F70
|
||||
public ReadOnlyCollection<Expression> Expressions
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.expressions;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600023B RID: 571 RVA: 0x0000BD78 File Offset: 0x00009F78
|
||||
private void EmitNewArrayInit(EmitContext ec, Type type)
|
||||
{
|
||||
int count = this.expressions.Count;
|
||||
ec.ig.Emit(OpCodes.Ldc_I4, count);
|
||||
ec.ig.Emit(OpCodes.Newarr, type);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Dup);
|
||||
ec.ig.Emit(OpCodes.Ldc_I4, i);
|
||||
this.expressions[i].Emit(ec);
|
||||
ec.ig.Emit(OpCodes.Stelem, type);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600023C RID: 572 RVA: 0x0000BE0C File Offset: 0x0000A00C
|
||||
private void EmitNewArrayBounds(EmitContext ec, Type type)
|
||||
{
|
||||
int count = this.expressions.Count;
|
||||
ec.EmitCollection<Expression>(this.expressions);
|
||||
if (count == 1)
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Newarr, type);
|
||||
return;
|
||||
}
|
||||
ec.ig.Emit(OpCodes.Newobj, NewArrayExpression.GetArrayConstructor(type, count));
|
||||
}
|
||||
|
||||
// Token: 0x0600023D RID: 573 RVA: 0x0000BE64 File Offset: 0x0000A064
|
||||
private static ConstructorInfo GetArrayConstructor(Type type, int rank)
|
||||
{
|
||||
return NewArrayExpression.CreateArray(type, rank).GetConstructor(NewArrayExpression.CreateTypeParameters(rank));
|
||||
}
|
||||
|
||||
// Token: 0x0600023E RID: 574 RVA: 0x0000BE78 File Offset: 0x0000A078
|
||||
private static Type[] CreateTypeParameters(int rank)
|
||||
{
|
||||
return Enumerable.Repeat<Type>(typeof(int), rank).ToArray<Type>();
|
||||
}
|
||||
|
||||
// Token: 0x0600023F RID: 575 RVA: 0x0000BE90 File Offset: 0x0000A090
|
||||
private static Type CreateArray(Type type, int rank)
|
||||
{
|
||||
return type.MakeArrayType(rank);
|
||||
}
|
||||
|
||||
// Token: 0x06000240 RID: 576 RVA: 0x0000BE9C File Offset: 0x0000A09C
|
||||
internal override void Emit(EmitContext ec)
|
||||
{
|
||||
Type elementType = base.Type.GetElementType();
|
||||
ExpressionType nodeType = base.NodeType;
|
||||
if (nodeType == ExpressionType.NewArrayInit)
|
||||
{
|
||||
this.EmitNewArrayInit(ec, elementType);
|
||||
return;
|
||||
}
|
||||
if (nodeType != ExpressionType.NewArrayBounds)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
this.EmitNewArrayBounds(ec, elementType);
|
||||
}
|
||||
|
||||
// Token: 0x040000B9 RID: 185
|
||||
private ReadOnlyCollection<Expression> expressions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents a constructor call.</summary>
|
||||
// Token: 0x0200002D RID: 45
|
||||
public sealed class NewExpression : Expression
|
||||
{
|
||||
// Token: 0x06000241 RID: 577 RVA: 0x0000BEE8 File Offset: 0x0000A0E8
|
||||
internal NewExpression(Type type, ReadOnlyCollection<Expression> arguments)
|
||||
: base(ExpressionType.New, type)
|
||||
{
|
||||
this.arguments = arguments;
|
||||
}
|
||||
|
||||
// Token: 0x06000242 RID: 578 RVA: 0x0000BEFC File Offset: 0x0000A0FC
|
||||
internal NewExpression(ConstructorInfo constructor, ReadOnlyCollection<Expression> arguments, ReadOnlyCollection<MemberInfo> members)
|
||||
: base(ExpressionType.New, constructor.DeclaringType)
|
||||
{
|
||||
this.constructor = constructor;
|
||||
this.arguments = arguments;
|
||||
this.members = members;
|
||||
}
|
||||
|
||||
/// <summary>Gets the called constructor.</summary>
|
||||
/// <returns>The <see cref="T:System.Reflection.ConstructorInfo" /> that represents the called constructor.</returns>
|
||||
// Token: 0x17000030 RID: 48
|
||||
// (get) Token: 0x06000243 RID: 579 RVA: 0x0000BF24 File Offset: 0x0000A124
|
||||
public ConstructorInfo Constructor
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.constructor;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the arguments to the constructor.</summary>
|
||||
/// <returns>A collection of <see cref="T:System.Linq.Expressions.Expression" /> objects that represent the arguments to the constructor.</returns>
|
||||
// Token: 0x17000031 RID: 49
|
||||
// (get) Token: 0x06000244 RID: 580 RVA: 0x0000BF2C File Offset: 0x0000A12C
|
||||
public ReadOnlyCollection<Expression> Arguments
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.arguments;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the members that can retrieve the values of the fields that were initialized with constructor arguments.</summary>
|
||||
/// <returns>A collection of <see cref="T:System.Reflection.MemberInfo" /> objects that represent the members that can retrieve the values of the fields that were initialized with constructor arguments.</returns>
|
||||
// Token: 0x17000032 RID: 50
|
||||
// (get) Token: 0x06000245 RID: 581 RVA: 0x0000BF34 File Offset: 0x0000A134
|
||||
public ReadOnlyCollection<MemberInfo> Members
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.members;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000246 RID: 582 RVA: 0x0000BF3C File Offset: 0x0000A13C
|
||||
internal override void Emit(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
Type type = base.Type;
|
||||
LocalBuilder localBuilder = null;
|
||||
if (type.IsValueType)
|
||||
{
|
||||
localBuilder = ig.DeclareLocal(type);
|
||||
ig.Emit(OpCodes.Ldloca, localBuilder);
|
||||
if (this.constructor == null)
|
||||
{
|
||||
ig.Emit(OpCodes.Initobj, type);
|
||||
ig.Emit(OpCodes.Ldloc, localBuilder);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ec.EmitCollection<Expression>(this.arguments);
|
||||
if (type.IsValueType)
|
||||
{
|
||||
ig.Emit(OpCodes.Call, this.constructor);
|
||||
ig.Emit(OpCodes.Ldloc, localBuilder);
|
||||
}
|
||||
else
|
||||
{
|
||||
ig.Emit(OpCodes.Newobj, this.constructor ?? NewExpression.GetDefaultConstructor(type));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000247 RID: 583 RVA: 0x0000BFF4 File Offset: 0x0000A1F4
|
||||
private static ConstructorInfo GetDefaultConstructor(Type type)
|
||||
{
|
||||
return type.GetConstructor(Type.EmptyTypes);
|
||||
}
|
||||
|
||||
// Token: 0x040000BA RID: 186
|
||||
private ConstructorInfo constructor;
|
||||
|
||||
// Token: 0x040000BB RID: 187
|
||||
private ReadOnlyCollection<Expression> arguments;
|
||||
|
||||
// Token: 0x040000BC RID: 188
|
||||
private ReadOnlyCollection<MemberInfo> members;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents a named parameter expression.</summary>
|
||||
// Token: 0x0200002E RID: 46
|
||||
public sealed class ParameterExpression : Expression
|
||||
{
|
||||
// Token: 0x06000248 RID: 584 RVA: 0x0000C004 File Offset: 0x0000A204
|
||||
internal ParameterExpression(Type type, string name)
|
||||
: base(ExpressionType.Parameter, type)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/// <summary>Gets the name of the parameter.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> that contains the name of the parameter.</returns>
|
||||
// Token: 0x17000033 RID: 51
|
||||
// (get) Token: 0x06000249 RID: 585 RVA: 0x0000C018 File Offset: 0x0000A218
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600024A RID: 586 RVA: 0x0000C020 File Offset: 0x0000A220
|
||||
private void EmitLocalParameter(EmitContext ec, int position)
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Ldarg, position);
|
||||
}
|
||||
|
||||
// Token: 0x0600024B RID: 587 RVA: 0x0000C034 File Offset: 0x0000A234
|
||||
private void EmitHoistedLocal(EmitContext ec, int level, int position)
|
||||
{
|
||||
ec.EmitScope();
|
||||
for (int i = 0; i < level; i++)
|
||||
{
|
||||
ec.EmitParentScope();
|
||||
}
|
||||
ec.EmitLoadLocals();
|
||||
ec.ig.Emit(OpCodes.Ldc_I4, position);
|
||||
ec.ig.Emit(OpCodes.Ldelem, typeof(object));
|
||||
ec.EmitLoadStrongBoxValue(base.Type);
|
||||
}
|
||||
|
||||
// Token: 0x0600024C RID: 588 RVA: 0x0000C09C File Offset: 0x0000A29C
|
||||
internal override void Emit(EmitContext ec)
|
||||
{
|
||||
int num = -1;
|
||||
if (ec.IsLocalParameter(this, ref num))
|
||||
{
|
||||
this.EmitLocalParameter(ec, num);
|
||||
return;
|
||||
}
|
||||
int num2 = 0;
|
||||
if (ec.IsHoistedLocal(this, ref num2, ref num))
|
||||
{
|
||||
this.EmitHoistedLocal(ec, num2, num);
|
||||
return;
|
||||
}
|
||||
throw new InvalidOperationException("Parameter out of scope");
|
||||
}
|
||||
|
||||
// Token: 0x040000BD RID: 189
|
||||
private string name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents an operation between an expression and a type.</summary>
|
||||
// Token: 0x0200002F RID: 47
|
||||
public sealed class TypeBinaryExpression : Expression
|
||||
{
|
||||
// Token: 0x0600024D RID: 589 RVA: 0x0000C0E8 File Offset: 0x0000A2E8
|
||||
internal TypeBinaryExpression(ExpressionType node_type, Expression expression, Type type_operand, Type type)
|
||||
: base(node_type, type)
|
||||
{
|
||||
this.expression = expression;
|
||||
this.type_operand = type_operand;
|
||||
}
|
||||
|
||||
/// <summary>Gets the expression operand of a type test operation.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the expression operand of a type test operation.</returns>
|
||||
// Token: 0x17000034 RID: 52
|
||||
// (get) Token: 0x0600024E RID: 590 RVA: 0x0000C104 File Offset: 0x0000A304
|
||||
public Expression Expression
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.expression;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the type operand of a type test operation.</summary>
|
||||
/// <returns>A <see cref="T:System.Type" /> that represents the type operand of a type test operation.</returns>
|
||||
// Token: 0x17000035 RID: 53
|
||||
// (get) Token: 0x0600024F RID: 591 RVA: 0x0000C10C File Offset: 0x0000A30C
|
||||
public Type TypeOperand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.type_operand;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000250 RID: 592 RVA: 0x0000C114 File Offset: 0x0000A314
|
||||
internal override void Emit(EmitContext ec)
|
||||
{
|
||||
if (this.expression.Type == typeof(void))
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Ldc_I4_0);
|
||||
return;
|
||||
}
|
||||
ec.EmitIsInst(this.expression, this.type_operand);
|
||||
ec.ig.Emit(OpCodes.Ldnull);
|
||||
ec.ig.Emit(OpCodes.Cgt_Un);
|
||||
}
|
||||
|
||||
// Token: 0x040000BE RID: 190
|
||||
private Expression expression;
|
||||
|
||||
// Token: 0x040000BF RID: 191
|
||||
private Type type_operand;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,460 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
|
||||
namespace System.Linq.Expressions
|
||||
{
|
||||
/// <summary>Represents an expression that has a unary operator.</summary>
|
||||
// Token: 0x02000030 RID: 48
|
||||
public sealed class UnaryExpression : Expression
|
||||
{
|
||||
// Token: 0x06000251 RID: 593 RVA: 0x0000C180 File Offset: 0x0000A380
|
||||
internal UnaryExpression(ExpressionType node_type, Expression operand, Type type)
|
||||
: base(node_type, type)
|
||||
{
|
||||
this.operand = operand;
|
||||
}
|
||||
|
||||
// Token: 0x06000252 RID: 594 RVA: 0x0000C194 File Offset: 0x0000A394
|
||||
internal UnaryExpression(ExpressionType node_type, Expression operand, Type type, MethodInfo method, bool is_lifted)
|
||||
: base(node_type, type)
|
||||
{
|
||||
this.operand = operand;
|
||||
this.method = method;
|
||||
this.is_lifted = is_lifted;
|
||||
}
|
||||
|
||||
/// <summary>Gets the operand of the unary operation.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.Expressions.Expression" /> that represents the operand of the unary operation.</returns>
|
||||
// Token: 0x17000036 RID: 54
|
||||
// (get) Token: 0x06000253 RID: 595 RVA: 0x0000C1B8 File Offset: 0x0000A3B8
|
||||
public Expression Operand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.operand;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the implementing method for the unary operation.</summary>
|
||||
/// <returns>The <see cref="T:System.Reflection.MethodInfo" /> that represents the implementing method.</returns>
|
||||
// Token: 0x17000037 RID: 55
|
||||
// (get) Token: 0x06000254 RID: 596 RVA: 0x0000C1C0 File Offset: 0x0000A3C0
|
||||
public MethodInfo Method
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.method;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value that indicates whether the expression tree node represents a lifted call to an operator.</summary>
|
||||
/// <returns>true if the node represents a lifted call; otherwise, false.</returns>
|
||||
// Token: 0x17000038 RID: 56
|
||||
// (get) Token: 0x06000255 RID: 597 RVA: 0x0000C1C8 File Offset: 0x0000A3C8
|
||||
public bool IsLifted
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.is_lifted;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value that indicates whether the expression tree node represents a lifted call to an operator whose return type is lifted to a nullable type.</summary>
|
||||
/// <returns>true if the operator's return type is lifted to a nullable type; otherwise, false.</returns>
|
||||
// Token: 0x17000039 RID: 57
|
||||
// (get) Token: 0x06000256 RID: 598 RVA: 0x0000C1D0 File Offset: 0x0000A3D0
|
||||
public bool IsLiftedToNull
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.is_lifted && base.Type.IsNullable();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000257 RID: 599 RVA: 0x0000C1EC File Offset: 0x0000A3EC
|
||||
private void EmitArrayLength(EmitContext ec)
|
||||
{
|
||||
this.operand.Emit(ec);
|
||||
ec.ig.Emit(OpCodes.Ldlen);
|
||||
}
|
||||
|
||||
// Token: 0x06000258 RID: 600 RVA: 0x0000C20C File Offset: 0x0000A40C
|
||||
private void EmitTypeAs(EmitContext ec)
|
||||
{
|
||||
Type type = base.Type;
|
||||
ec.EmitIsInst(this.operand, type);
|
||||
if (type.IsNullable())
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Unbox_Any, type);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000259 RID: 601 RVA: 0x0000C24C File Offset: 0x0000A44C
|
||||
private void EmitLiftedUnary(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.operand);
|
||||
LocalBuilder localBuilder2 = ig.DeclareLocal(base.Type);
|
||||
Label label = ig.DefineLabel();
|
||||
Label label2 = ig.DefineLabel();
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
ig.Emit(OpCodes.Brtrue, label);
|
||||
ec.EmitNullableInitialize(localBuilder2);
|
||||
ig.Emit(OpCodes.Br, label2);
|
||||
ig.MarkLabel(label);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder);
|
||||
this.EmitUnaryOperator(ec);
|
||||
ec.EmitNullableNew(base.Type);
|
||||
ig.MarkLabel(label2);
|
||||
}
|
||||
|
||||
// Token: 0x0600025A RID: 602 RVA: 0x0000C2DC File Offset: 0x0000A4DC
|
||||
private void EmitUnaryOperator(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
ExpressionType nodeType = base.NodeType;
|
||||
switch (nodeType)
|
||||
{
|
||||
case ExpressionType.Negate:
|
||||
ig.Emit(OpCodes.Neg);
|
||||
break;
|
||||
default:
|
||||
if (nodeType != ExpressionType.Convert && nodeType != ExpressionType.ConvertChecked)
|
||||
{
|
||||
if (nodeType == ExpressionType.Not)
|
||||
{
|
||||
if (this.operand.Type.GetNotNullableType() == typeof(bool))
|
||||
{
|
||||
ig.Emit(OpCodes.Ldc_I4_0);
|
||||
ig.Emit(OpCodes.Ceq);
|
||||
}
|
||||
else
|
||||
{
|
||||
ig.Emit(OpCodes.Not);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EmitPrimitiveConversion(ec, this.operand.Type.GetNotNullableType(), base.Type.GetNotNullableType());
|
||||
}
|
||||
break;
|
||||
case ExpressionType.NegateChecked:
|
||||
ig.Emit(OpCodes.Ldc_I4_M1);
|
||||
ig.Emit((!Expression.IsUnsigned(this.operand.Type)) ? OpCodes.Mul_Ovf : OpCodes.Mul_Ovf_Un);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600025B RID: 603 RVA: 0x0000C3E4 File Offset: 0x0000A5E4
|
||||
private void EmitConvert(EmitContext ec)
|
||||
{
|
||||
Type type = this.operand.Type;
|
||||
Type type2 = base.Type;
|
||||
if (type == type2)
|
||||
{
|
||||
this.operand.Emit(ec);
|
||||
}
|
||||
else if (type.IsNullable() && !type2.IsNullable())
|
||||
{
|
||||
this.EmitConvertFromNullable(ec);
|
||||
}
|
||||
else if (!type.IsNullable() && type2.IsNullable())
|
||||
{
|
||||
this.EmitConvertToNullable(ec);
|
||||
}
|
||||
else if (type.IsNullable() && type2.IsNullable())
|
||||
{
|
||||
this.EmitConvertFromNullableToNullable(ec);
|
||||
}
|
||||
else if (Expression.IsReferenceConversion(type, type2))
|
||||
{
|
||||
this.EmitCast(ec);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Expression.IsPrimitiveConversion(type, type2))
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
this.EmitPrimitiveConversion(ec);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600025C RID: 604 RVA: 0x0000C4B8 File Offset: 0x0000A6B8
|
||||
private void EmitConvertFromNullableToNullable(EmitContext ec)
|
||||
{
|
||||
this.EmitLiftedUnary(ec);
|
||||
}
|
||||
|
||||
// Token: 0x0600025D RID: 605 RVA: 0x0000C4C4 File Offset: 0x0000A6C4
|
||||
private void EmitConvertToNullable(EmitContext ec)
|
||||
{
|
||||
ec.Emit(this.operand);
|
||||
if (this.IsUnBoxing())
|
||||
{
|
||||
this.EmitUnbox(ec);
|
||||
return;
|
||||
}
|
||||
if (this.operand.Type != base.Type.GetNotNullableType())
|
||||
{
|
||||
this.EmitPrimitiveConversion(ec, this.operand.Type, base.Type.GetNotNullableType());
|
||||
}
|
||||
ec.EmitNullableNew(base.Type);
|
||||
}
|
||||
|
||||
// Token: 0x0600025E RID: 606 RVA: 0x0000C534 File Offset: 0x0000A734
|
||||
private void EmitConvertFromNullable(EmitContext ec)
|
||||
{
|
||||
if (this.IsBoxing())
|
||||
{
|
||||
ec.Emit(this.operand);
|
||||
this.EmitBox(ec);
|
||||
return;
|
||||
}
|
||||
ec.EmitCall(this.operand, this.operand.Type.GetMethod("get_Value"));
|
||||
if (this.operand.Type.GetNotNullableType() != base.Type)
|
||||
{
|
||||
this.EmitPrimitiveConversion(ec, this.operand.Type.GetNotNullableType(), base.Type);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600025F RID: 607 RVA: 0x0000C5BC File Offset: 0x0000A7BC
|
||||
private bool IsBoxing()
|
||||
{
|
||||
return this.operand.Type.IsValueType && !base.Type.IsValueType;
|
||||
}
|
||||
|
||||
// Token: 0x06000260 RID: 608 RVA: 0x0000C5F0 File Offset: 0x0000A7F0
|
||||
private void EmitBox(EmitContext ec)
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Box, this.operand.Type);
|
||||
}
|
||||
|
||||
// Token: 0x06000261 RID: 609 RVA: 0x0000C610 File Offset: 0x0000A810
|
||||
private bool IsUnBoxing()
|
||||
{
|
||||
return !this.operand.Type.IsValueType && base.Type.IsValueType;
|
||||
}
|
||||
|
||||
// Token: 0x06000262 RID: 610 RVA: 0x0000C640 File Offset: 0x0000A840
|
||||
private void EmitUnbox(EmitContext ec)
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Unbox_Any, base.Type);
|
||||
}
|
||||
|
||||
// Token: 0x06000263 RID: 611 RVA: 0x0000C658 File Offset: 0x0000A858
|
||||
private void EmitCast(EmitContext ec)
|
||||
{
|
||||
this.operand.Emit(ec);
|
||||
if (this.IsBoxing())
|
||||
{
|
||||
this.EmitBox(ec);
|
||||
}
|
||||
else if (this.IsUnBoxing())
|
||||
{
|
||||
this.EmitUnbox(ec);
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Castclass, base.Type);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000264 RID: 612 RVA: 0x0000C6B8 File Offset: 0x0000A8B8
|
||||
private void EmitPrimitiveConversion(EmitContext ec, bool is_unsigned, OpCode signed, OpCode unsigned, OpCode signed_checked, OpCode unsigned_checked)
|
||||
{
|
||||
if (base.NodeType != ExpressionType.ConvertChecked)
|
||||
{
|
||||
ec.ig.Emit((!is_unsigned) ? signed : unsigned);
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.ig.Emit((!is_unsigned) ? signed_checked : unsigned_checked);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000265 RID: 613 RVA: 0x0000C70C File Offset: 0x0000A90C
|
||||
private void EmitPrimitiveConversion(EmitContext ec)
|
||||
{
|
||||
this.operand.Emit(ec);
|
||||
this.EmitPrimitiveConversion(ec, this.operand.Type, base.Type);
|
||||
}
|
||||
|
||||
// Token: 0x06000266 RID: 614 RVA: 0x0000C740 File Offset: 0x0000A940
|
||||
private void EmitPrimitiveConversion(EmitContext ec, Type from, Type to)
|
||||
{
|
||||
bool flag = Expression.IsUnsigned(from);
|
||||
switch (Type.GetTypeCode(to))
|
||||
{
|
||||
case TypeCode.SByte:
|
||||
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I1, OpCodes.Conv_U1, OpCodes.Conv_Ovf_I1, OpCodes.Conv_Ovf_I1_Un);
|
||||
return;
|
||||
case TypeCode.Byte:
|
||||
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I1, OpCodes.Conv_U1, OpCodes.Conv_Ovf_U1, OpCodes.Conv_Ovf_U1_Un);
|
||||
return;
|
||||
case TypeCode.Int16:
|
||||
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I2, OpCodes.Conv_U2, OpCodes.Conv_Ovf_I2, OpCodes.Conv_Ovf_I2_Un);
|
||||
return;
|
||||
case TypeCode.UInt16:
|
||||
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I2, OpCodes.Conv_U2, OpCodes.Conv_Ovf_U2, OpCodes.Conv_Ovf_U2_Un);
|
||||
return;
|
||||
case TypeCode.Int32:
|
||||
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I4, OpCodes.Conv_U4, OpCodes.Conv_Ovf_I4, OpCodes.Conv_Ovf_I4_Un);
|
||||
return;
|
||||
case TypeCode.UInt32:
|
||||
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I4, OpCodes.Conv_U4, OpCodes.Conv_Ovf_U4, OpCodes.Conv_Ovf_U4_Un);
|
||||
return;
|
||||
case TypeCode.Int64:
|
||||
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I8, OpCodes.Conv_U8, OpCodes.Conv_Ovf_I8, OpCodes.Conv_Ovf_I8_Un);
|
||||
return;
|
||||
case TypeCode.UInt64:
|
||||
this.EmitPrimitiveConversion(ec, flag, OpCodes.Conv_I8, OpCodes.Conv_U8, OpCodes.Conv_Ovf_U8, OpCodes.Conv_Ovf_U8_Un);
|
||||
return;
|
||||
case TypeCode.Single:
|
||||
if (flag)
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Conv_R_Un);
|
||||
}
|
||||
ec.ig.Emit(OpCodes.Conv_R4);
|
||||
return;
|
||||
case TypeCode.Double:
|
||||
if (flag)
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Conv_R_Un);
|
||||
}
|
||||
ec.ig.Emit(OpCodes.Conv_R8);
|
||||
return;
|
||||
default:
|
||||
throw new NotImplementedException(base.Type.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000267 RID: 615 RVA: 0x0000C8D8 File Offset: 0x0000AAD8
|
||||
private void EmitArithmeticUnary(EmitContext ec)
|
||||
{
|
||||
if (!this.IsLifted)
|
||||
{
|
||||
this.operand.Emit(ec);
|
||||
this.EmitUnaryOperator(ec);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EmitLiftedUnary(ec);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000268 RID: 616 RVA: 0x0000C910 File Offset: 0x0000AB10
|
||||
private void EmitUserDefinedLiftedToNullOperator(EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.operand);
|
||||
Label label = ig.DefineLabel();
|
||||
Label label2 = ig.DefineLabel();
|
||||
ec.EmitNullableHasValue(localBuilder);
|
||||
ig.Emit(OpCodes.Brfalse, label);
|
||||
ec.EmitNullableGetValueOrDefault(localBuilder);
|
||||
ec.EmitCall(this.method);
|
||||
ec.EmitNullableNew(base.Type);
|
||||
ig.Emit(OpCodes.Br, label2);
|
||||
ig.MarkLabel(label);
|
||||
LocalBuilder localBuilder2 = ig.DeclareLocal(base.Type);
|
||||
ec.EmitNullableInitialize(localBuilder2);
|
||||
ig.MarkLabel(label2);
|
||||
}
|
||||
|
||||
// Token: 0x06000269 RID: 617 RVA: 0x0000C9A4 File Offset: 0x0000ABA4
|
||||
private void EmitUserDefinedLiftedOperator(EmitContext ec)
|
||||
{
|
||||
LocalBuilder localBuilder = ec.EmitStored(this.operand);
|
||||
ec.EmitNullableGetValue(localBuilder);
|
||||
ec.EmitCall(this.method);
|
||||
}
|
||||
|
||||
// Token: 0x0600026A RID: 618 RVA: 0x0000C9D4 File Offset: 0x0000ABD4
|
||||
private void EmitUserDefinedOperator(EmitContext ec)
|
||||
{
|
||||
if (!this.IsLifted)
|
||||
{
|
||||
ec.Emit(this.operand);
|
||||
ec.EmitCall(this.method);
|
||||
}
|
||||
else if (this.IsLiftedToNull)
|
||||
{
|
||||
this.EmitUserDefinedLiftedToNullOperator(ec);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.EmitUserDefinedLiftedOperator(ec);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600026B RID: 619 RVA: 0x0000CA28 File Offset: 0x0000AC28
|
||||
private void EmitQuote(EmitContext ec)
|
||||
{
|
||||
ec.EmitScope();
|
||||
ec.EmitReadGlobal(this.operand, typeof(Expression));
|
||||
if (ec.HasHoistedLocals)
|
||||
{
|
||||
ec.EmitLoadHoistedLocalsStore();
|
||||
}
|
||||
else
|
||||
{
|
||||
ec.ig.Emit(OpCodes.Ldnull);
|
||||
}
|
||||
ec.EmitIsolateExpression();
|
||||
}
|
||||
|
||||
// Token: 0x0600026C RID: 620 RVA: 0x0000CA80 File Offset: 0x0000AC80
|
||||
internal override void Emit(EmitContext ec)
|
||||
{
|
||||
if (this.method != null)
|
||||
{
|
||||
this.EmitUserDefinedOperator(ec);
|
||||
return;
|
||||
}
|
||||
ExpressionType nodeType = base.NodeType;
|
||||
switch (nodeType)
|
||||
{
|
||||
case ExpressionType.Negate:
|
||||
case ExpressionType.UnaryPlus:
|
||||
case ExpressionType.NegateChecked:
|
||||
case ExpressionType.Not:
|
||||
this.EmitArithmeticUnary(ec);
|
||||
return;
|
||||
default:
|
||||
if (nodeType == ExpressionType.Convert || nodeType == ExpressionType.ConvertChecked)
|
||||
{
|
||||
this.EmitConvert(ec);
|
||||
return;
|
||||
}
|
||||
if (nodeType == ExpressionType.ArrayLength)
|
||||
{
|
||||
this.EmitArrayLength(ec);
|
||||
return;
|
||||
}
|
||||
if (nodeType == ExpressionType.Quote)
|
||||
{
|
||||
this.EmitQuote(ec);
|
||||
return;
|
||||
}
|
||||
if (nodeType != ExpressionType.TypeAs)
|
||||
{
|
||||
throw new NotImplementedException(base.NodeType.ToString());
|
||||
}
|
||||
this.EmitTypeAs(ec);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000C0 RID: 192
|
||||
private Expression operand;
|
||||
|
||||
// Token: 0x040000C1 RID: 193
|
||||
private MethodInfo method;
|
||||
|
||||
// Token: 0x040000C2 RID: 194
|
||||
private bool is_lifted;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
// Token: 0x02000036 RID: 54
|
||||
internal class Grouping<K, T> : IEnumerable, IEnumerable<T>, IGrouping<K, T>
|
||||
{
|
||||
// Token: 0x06000383 RID: 899 RVA: 0x00010D20 File Offset: 0x0000EF20
|
||||
public Grouping(K key, IEnumerable<T> group)
|
||||
{
|
||||
this.group = group;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
// Token: 0x06000384 RID: 900 RVA: 0x00010D38 File Offset: 0x0000EF38
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return this.group.GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x1700003A RID: 58
|
||||
// (get) Token: 0x06000385 RID: 901 RVA: 0x00010D48 File Offset: 0x0000EF48
|
||||
// (set) Token: 0x06000386 RID: 902 RVA: 0x00010D50 File Offset: 0x0000EF50
|
||||
public K Key
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.key;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.key = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000387 RID: 903 RVA: 0x00010D5C File Offset: 0x0000EF5C
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
return this.group.GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x040000E7 RID: 231
|
||||
private K key;
|
||||
|
||||
// Token: 0x040000E8 RID: 232
|
||||
private IEnumerable<T> group;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
/// <summary>Represents a collection of objects that have a common key.</summary>
|
||||
/// <typeparam name="TKey">The type of the key of the <see cref="T:System.Linq.IGrouping`2" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the values in the <see cref="T:System.Linq.IGrouping`2" />.</typeparam>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x02000037 RID: 55
|
||||
public interface IGrouping<TKey, TElement> : IEnumerable, IEnumerable<TElement>
|
||||
{
|
||||
/// <summary>Gets the key of the <see cref="T:System.Linq.IGrouping`2" />.</summary>
|
||||
/// <returns>The key of the <see cref="T:System.Linq.IGrouping`2" />.</returns>
|
||||
// Token: 0x1700003B RID: 59
|
||||
// (get) Token: 0x06000388 RID: 904
|
||||
TKey Key { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
/// <summary>Defines an indexer, size property, and Boolean search method for data structures that map keys to <see cref="T:System.Collections.Generic.IEnumerable`1" /> sequences of values.</summary>
|
||||
/// <typeparam name="TKey">The type of the keys in the <see cref="T:System.Linq.ILookup`2" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the elements in the <see cref="T:System.Collections.Generic.IEnumerable`1" /> sequences that make up the values in the <see cref="T:System.Linq.ILookup`2" />.</typeparam>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x02000038 RID: 56
|
||||
public interface ILookup<TKey, TElement> : IEnumerable, IEnumerable<IGrouping<TKey, TElement>>
|
||||
{
|
||||
/// <summary>Gets the number of key/value collection pairs in the <see cref="T:System.Linq.ILookup`2" />.</summary>
|
||||
/// <returns>The number of key/value collection pairs in the <see cref="T:System.Linq.ILookup`2" />.</returns>
|
||||
// Token: 0x1700003C RID: 60
|
||||
// (get) Token: 0x06000389 RID: 905
|
||||
int Count { get; }
|
||||
|
||||
/// <summary>Gets the <see cref="T:System.Collections.Generic.IEnumerable`1" /> sequence of values indexed by a specified key.</summary>
|
||||
/// <returns>The <see cref="T:System.Collections.Generic.IEnumerable`1" /> sequence of values indexed by the specified key.</returns>
|
||||
/// <param name="key">The key of the desired sequence of values.</param>
|
||||
// Token: 0x1700003D RID: 61
|
||||
IEnumerable<TElement> this[TKey key] { get; }
|
||||
|
||||
/// <summary>Determines whether a specified key exists in the <see cref="T:System.Linq.ILookup`2" />.</summary>
|
||||
/// <returns>true if <paramref name="key" /> is in the <see cref="T:System.Linq.ILookup`2" />; otherwise, false.</returns>
|
||||
/// <param name="key">The key to search for in the <see cref="T:System.Linq.ILookup`2" />.</param>
|
||||
// Token: 0x0600038B RID: 907
|
||||
bool Contains(TKey key);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
/// <summary>Represents a sorted sequence.</summary>
|
||||
/// <typeparam name="TElement">The type of the elements of the sequence.</typeparam>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x02000039 RID: 57
|
||||
public interface IOrderedEnumerable<TElement> : IEnumerable, IEnumerable<TElement>
|
||||
{
|
||||
/// <summary>Performs a subsequent ordering on the elements of an <see cref="T:System.Linq.IOrderedEnumerable`1" /> according to a key.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedEnumerable`1" /> whose elements are sorted according to a key.</returns>
|
||||
/// <param name="keySelector">The <see cref="T:System.Func`2" /> used to extract the key for each element.</param>
|
||||
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> used to compare keys for placement in the returned sequence.</param>
|
||||
/// <param name="descending">true to sort the elements in descending order; false to sort the elements in ascending order.</param>
|
||||
/// <typeparam name="TKey">The type of the key produced by <paramref name="keySelector" />.</typeparam>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600038C RID: 908
|
||||
IOrderedEnumerable<TElement> CreateOrderedEnumerable<TKey>(Func<TElement, TKey> selector, IComparer<TKey> comparer, bool descending);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
/// <summary>Represents the result of a sorting operation.</summary>
|
||||
/// <typeparam name="T">The type of the content of the data source.</typeparam>
|
||||
// Token: 0x0200003B RID: 59
|
||||
public interface IOrderedQueryable<T> : IEnumerable, IOrderedQueryable, IQueryable, IQueryable<T>, IEnumerable<T>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
/// <summary>Represents the result of a sorting operation.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0200003A RID: 58
|
||||
public interface IOrderedQueryable : IEnumerable, IQueryable
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
/// <summary>Defines methods to create and execute queries that are described by an <see cref="T:System.Linq.IQueryable" /> object.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0200003C RID: 60
|
||||
public interface IQueryProvider
|
||||
{
|
||||
/// <summary>Constructs an <see cref="T:System.Linq.IQueryable" /> object that can evaluate the query represented by a specified expression tree.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable" /> that can evaluate the query represented by the specified expression tree.</returns>
|
||||
/// <param name="expression">An expression tree that represents a LINQ query.</param>
|
||||
// Token: 0x0600038D RID: 909
|
||||
IQueryable CreateQuery(Expression expression);
|
||||
|
||||
/// <summary>Executes the query represented by a specified expression tree.</summary>
|
||||
/// <returns>The value that results from executing the specified query.</returns>
|
||||
/// <param name="expression">An expression tree that represents a LINQ query.</param>
|
||||
// Token: 0x0600038E RID: 910
|
||||
object Execute(Expression expression);
|
||||
|
||||
/// <summary>Constructs an <see cref="T:System.Linq.IQueryable`1" /> object that can evaluate the query represented by a specified expression tree.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that can evaluate the query represented by the specified expression tree.</returns>
|
||||
/// <param name="expression">An expression tree that represents a LINQ query.</param>
|
||||
/// <typeparam name="TElement">The type of the elements of the <see cref="T:System.Linq.IQueryable`1" /> that is returned.</typeparam>
|
||||
// Token: 0x0600038F RID: 911
|
||||
IQueryable<TElement> CreateQuery<TElement>(Expression expression);
|
||||
|
||||
/// <summary>Executes the strongly-typed query represented by a specified expression tree.</summary>
|
||||
/// <returns>The value that results from executing the specified query.</returns>
|
||||
/// <param name="expression">An expression tree that represents a LINQ query.</param>
|
||||
/// <typeparam name="TResult">The type of the value that results from executing the query.</typeparam>
|
||||
// Token: 0x06000390 RID: 912
|
||||
TResult Execute<TResult>(Expression expression);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
/// <summary>Provides functionality to evaluate queries against a specific data source wherein the type of the data is known.</summary>
|
||||
/// <typeparam name="T">The type of the data in the data source.</typeparam>
|
||||
// Token: 0x0200003E RID: 62
|
||||
public interface IQueryable<T> : IEnumerable, IQueryable, IEnumerable<T>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
/// <summary>Provides functionality to evaluate queries against a specific data source wherein the type of the data is not specified.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0200003D RID: 61
|
||||
public interface IQueryable : IEnumerable
|
||||
{
|
||||
/// <summary>Gets the type of the element(s) that are returned when the expression tree associated with this instance of <see cref="T:System.Linq.IQueryable" /> is executed.</summary>
|
||||
/// <returns>A <see cref="T:System.Type" /> that represents the type of the element(s) that are returned when the expression tree associated with this object is executed.</returns>
|
||||
// Token: 0x1700003E RID: 62
|
||||
// (get) Token: 0x06000391 RID: 913
|
||||
Type ElementType { get; }
|
||||
|
||||
/// <summary>Gets the expression tree that is associated with the instance of <see cref="T:System.Linq.IQueryable" />.</summary>
|
||||
/// <returns>The <see cref="T:System.Linq.Expressions.Expression" /> that is associated with this instance of <see cref="T:System.Linq.IQueryable" />.</returns>
|
||||
// Token: 0x1700003F RID: 63
|
||||
// (get) Token: 0x06000392 RID: 914
|
||||
Expression Expression { get; }
|
||||
|
||||
/// <summary>Gets the query provider that is associated with this data source.</summary>
|
||||
/// <returns>The <see cref="T:System.Linq.IQueryProvider" /> that is associated with this data source.</returns>
|
||||
// Token: 0x17000040 RID: 64
|
||||
// (get) Token: 0x06000393 RID: 915
|
||||
IQueryProvider Provider { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
// Token: 0x02000044 RID: 68
|
||||
internal interface IQueryableEnumerable<TElement> : IEnumerable, IOrderedQueryable, IQueryable, IQueryableEnumerable, IQueryable<TElement>, IEnumerable<TElement>, IOrderedQueryable<TElement>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
// Token: 0x02000043 RID: 67
|
||||
internal interface IQueryableEnumerable : IEnumerable, IQueryable
|
||||
{
|
||||
// Token: 0x06000422 RID: 1058
|
||||
IEnumerable GetEnumerable();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
/// <summary>Represents a collection of keys each mapped to one or more values.</summary>
|
||||
/// <typeparam name="TKey">The type of the keys in the <see cref="T:System.Linq.Lookup`2" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the elements of each <see cref="T:System.Collections.Generic.IEnumerable`1" /> value in the <see cref="T:System.Linq.Lookup`2" />.</typeparam>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0200003F RID: 63
|
||||
public class Lookup<TKey, TElement> : IEnumerable, IEnumerable<IGrouping<TKey, TElement>>, ILookup<TKey, TElement>
|
||||
{
|
||||
// Token: 0x06000394 RID: 916 RVA: 0x00010D6C File Offset: 0x0000EF6C
|
||||
internal Lookup(Dictionary<TKey, List<TElement>> lookup, IEnumerable<TElement> nullKeyElements)
|
||||
{
|
||||
this.groups = new Dictionary<TKey, IGrouping<TKey, TElement>>(lookup.Comparer);
|
||||
foreach (KeyValuePair<TKey, List<TElement>> keyValuePair in lookup)
|
||||
{
|
||||
this.groups.Add(keyValuePair.Key, new Grouping<TKey, TElement>(keyValuePair.Key, keyValuePair.Value));
|
||||
}
|
||||
if (nullKeyElements != null)
|
||||
{
|
||||
this.nullGrouping = new Grouping<TKey, TElement>(default(TKey), nullKeyElements);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Returns an enumerator that iterates through the <see cref="T:System.Linq.Lookup`2" />. This class cannot be inherited.</summary>
|
||||
/// <returns>An enumerator for the <see cref="T:System.Linq.Lookup`2" />.</returns>
|
||||
// Token: 0x06000395 RID: 917 RVA: 0x00010E20 File Offset: 0x0000F020
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return this.GetEnumerator();
|
||||
}
|
||||
|
||||
/// <summary>Gets the number of key/value collection pairs in the <see cref="T:System.Linq.Lookup`2" />.</summary>
|
||||
/// <returns>The number of key/value collection pairs in the <see cref="T:System.Linq.Lookup`2" />.</returns>
|
||||
// Token: 0x17000041 RID: 65
|
||||
// (get) Token: 0x06000396 RID: 918 RVA: 0x00010E28 File Offset: 0x0000F028
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this.nullGrouping != null) ? (this.groups.Count + 1) : this.groups.Count;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the collection of values indexed by the specified key.</summary>
|
||||
/// <returns>The collection of values indexed by the specified key.</returns>
|
||||
/// <param name="key">The key of the desired collection of values.</param>
|
||||
// Token: 0x17000042 RID: 66
|
||||
public IEnumerable<TElement> this[TKey key]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (key == null && this.nullGrouping != null)
|
||||
{
|
||||
return this.nullGrouping;
|
||||
}
|
||||
IGrouping<TKey, TElement> grouping;
|
||||
if (key != null && this.groups.TryGetValue(key, out grouping))
|
||||
{
|
||||
return grouping;
|
||||
}
|
||||
return new TElement[0];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Applies a transform function to each key and its associated values and returns the results.</summary>
|
||||
/// <returns>A collection that contains one value for each key/value collection pair in the <see cref="T:System.Linq.Lookup`2" />.</returns>
|
||||
/// <param name="resultSelector">A function to project a result value from each key and its associated values.</param>
|
||||
/// <typeparam name="TResult">The type of the result values produced by <paramref name="resultSelector" />.</typeparam>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06000398 RID: 920 RVA: 0x00010EB0 File Offset: 0x0000F0B0
|
||||
public IEnumerable<TResult> ApplyResultSelector<TResult>(Func<TKey, IEnumerable<TElement>, TResult> selector)
|
||||
{
|
||||
if (this.nullGrouping != null)
|
||||
{
|
||||
yield return selector(this.nullGrouping.Key, this.nullGrouping);
|
||||
}
|
||||
foreach (IGrouping<TKey, TElement> group in this.groups.Values)
|
||||
{
|
||||
yield return selector(group.Key, group);
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
/// <summary>Determines whether a specified key is in the <see cref="T:System.Linq.Lookup`2" />.</summary>
|
||||
/// <returns>true if <paramref name="key" /> is in the <see cref="T:System.Linq.Lookup`2" />; otherwise, false.</returns>
|
||||
/// <param name="key">The key to find in the <see cref="T:System.Linq.Lookup`2" />.</param>
|
||||
// Token: 0x06000399 RID: 921 RVA: 0x00010EE4 File Offset: 0x0000F0E4
|
||||
public bool Contains(TKey key)
|
||||
{
|
||||
return (key == null) ? (this.nullGrouping != null) : this.groups.ContainsKey(key);
|
||||
}
|
||||
|
||||
/// <summary>Returns a generic enumerator that iterates through the <see cref="T:System.Linq.Lookup`2" />.</summary>
|
||||
/// <returns>An enumerator for the <see cref="T:System.Linq.Lookup`2" />.</returns>
|
||||
// Token: 0x0600039A RID: 922 RVA: 0x00010F1C File Offset: 0x0000F11C
|
||||
public IEnumerator<IGrouping<TKey, TElement>> GetEnumerator()
|
||||
{
|
||||
if (this.nullGrouping != null)
|
||||
{
|
||||
yield return this.nullGrouping;
|
||||
}
|
||||
foreach (IGrouping<TKey, TElement> g in this.groups.Values)
|
||||
{
|
||||
yield return g;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
// Token: 0x040000E9 RID: 233
|
||||
private IGrouping<TKey, TElement> nullGrouping;
|
||||
|
||||
// Token: 0x040000EA RID: 234
|
||||
private Dictionary<TKey, IGrouping<TKey, TElement>> groups;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
// Token: 0x02000040 RID: 64
|
||||
internal abstract class OrderedEnumerable<TElement> : IEnumerable, IEnumerable<TElement>, IOrderedEnumerable<TElement>
|
||||
{
|
||||
// Token: 0x0600039B RID: 923 RVA: 0x00010F38 File Offset: 0x0000F138
|
||||
protected OrderedEnumerable(IEnumerable<TElement> source)
|
||||
{
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
// Token: 0x0600039C RID: 924 RVA: 0x00010F48 File Offset: 0x0000F148
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return this.GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x0600039D RID: 925 RVA: 0x00010F50 File Offset: 0x0000F150
|
||||
public IEnumerator<TElement> GetEnumerator()
|
||||
{
|
||||
return this.Sort(this.source).GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x0600039E RID: 926
|
||||
public abstract SortContext<TElement> CreateContext(SortContext<TElement> current);
|
||||
|
||||
// Token: 0x0600039F RID: 927
|
||||
protected abstract IEnumerable<TElement> Sort(IEnumerable<TElement> source);
|
||||
|
||||
// Token: 0x060003A0 RID: 928 RVA: 0x00010F64 File Offset: 0x0000F164
|
||||
public IOrderedEnumerable<TElement> CreateOrderedEnumerable<TKey>(Func<TElement, TKey> selector, IComparer<TKey> comparer, bool descending)
|
||||
{
|
||||
return new OrderedSequence<TElement, TKey>(this, this.source, selector, comparer, (!descending) ? SortDirection.Ascending : SortDirection.Descending);
|
||||
}
|
||||
|
||||
// Token: 0x040000EB RID: 235
|
||||
private IEnumerable<TElement> source;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
// Token: 0x02000041 RID: 65
|
||||
internal class OrderedSequence<TElement, TKey> : OrderedEnumerable<TElement>
|
||||
{
|
||||
// Token: 0x060003A1 RID: 929 RVA: 0x00010F84 File Offset: 0x0000F184
|
||||
internal OrderedSequence(IEnumerable<TElement> source, Func<TElement, TKey> key_selector, IComparer<TKey> comparer, SortDirection direction)
|
||||
: base(source)
|
||||
{
|
||||
this.selector = key_selector;
|
||||
this.comparer = comparer ?? Comparer<TKey>.Default;
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
// Token: 0x060003A2 RID: 930 RVA: 0x00010FB0 File Offset: 0x0000F1B0
|
||||
internal OrderedSequence(OrderedEnumerable<TElement> parent, IEnumerable<TElement> source, Func<TElement, TKey> keySelector, IComparer<TKey> comparer, SortDirection direction)
|
||||
: this(source, keySelector, comparer, direction)
|
||||
{
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
// Token: 0x060003A3 RID: 931 RVA: 0x00010FC8 File Offset: 0x0000F1C8
|
||||
public override SortContext<TElement> CreateContext(SortContext<TElement> current)
|
||||
{
|
||||
SortContext<TElement> sortContext = new SortSequenceContext<TElement, TKey>(this.selector, this.comparer, this.direction, current);
|
||||
if (this.parent != null)
|
||||
{
|
||||
return this.parent.CreateContext(sortContext);
|
||||
}
|
||||
return sortContext;
|
||||
}
|
||||
|
||||
// Token: 0x060003A4 RID: 932 RVA: 0x00011008 File Offset: 0x0000F208
|
||||
protected override IEnumerable<TElement> Sort(IEnumerable<TElement> source)
|
||||
{
|
||||
return QuickSort<TElement>.Sort(source, this.CreateContext(null));
|
||||
}
|
||||
|
||||
// Token: 0x040000EC RID: 236
|
||||
private OrderedEnumerable<TElement> parent;
|
||||
|
||||
// Token: 0x040000ED RID: 237
|
||||
private Func<TElement, TKey> selector;
|
||||
|
||||
// Token: 0x040000EE RID: 238
|
||||
private IComparer<TKey> comparer;
|
||||
|
||||
// Token: 0x040000EF RID: 239
|
||||
private SortDirection direction;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2393 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
/// <summary>Provides a set of static (Shared in Visual Basic) methods for querying data structures that implement <see cref="T:System.Linq.IQueryable`1" />.</summary>
|
||||
// Token: 0x02000042 RID: 66
|
||||
public static class Queryable
|
||||
{
|
||||
// Token: 0x060003A5 RID: 933 RVA: 0x00011018 File Offset: 0x0000F218
|
||||
private static MethodInfo MakeGeneric(MethodBase method, params Type[] parameters)
|
||||
{
|
||||
return ((MethodInfo)method).MakeGenericMethod(parameters);
|
||||
}
|
||||
|
||||
// Token: 0x060003A6 RID: 934 RVA: 0x00011028 File Offset: 0x0000F228
|
||||
private static Expression StaticCall(MethodInfo method, params Expression[] expressions)
|
||||
{
|
||||
return Expression.Call(null, method, expressions);
|
||||
}
|
||||
|
||||
// Token: 0x060003A7 RID: 935 RVA: 0x00011034 File Offset: 0x0000F234
|
||||
private static TRet Execute<TRet, TSource>(this IQueryable<TSource> source, MethodBase current)
|
||||
{
|
||||
return source.Provider.Execute<TRet>(Queryable.StaticCall(Queryable.MakeGeneric(current, new Type[] { typeof(TSource) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Applies an accumulator function over a sequence.</summary>
|
||||
/// <returns>The final accumulator value.</returns>
|
||||
/// <param name="source">A sequence to aggregate over.</param>
|
||||
/// <param name="func">An accumulator function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="func" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060003A8 RID: 936 RVA: 0x0001107C File Offset: 0x0000F27C
|
||||
public static TSource Aggregate<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, TSource, TSource>> func)
|
||||
{
|
||||
Check.SourceAndFunc(source, func);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(func)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.</summary>
|
||||
/// <returns>The final accumulator value.</returns>
|
||||
/// <param name="source">A sequence to aggregate over.</param>
|
||||
/// <param name="seed">The initial accumulator value.</param>
|
||||
/// <param name="func">An accumulator function to invoke on each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TAccumulate">The type of the accumulator value.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="func" /> is null.</exception>
|
||||
// Token: 0x060003A9 RID: 937 RVA: 0x000110D8 File Offset: 0x0000F2D8
|
||||
public static TAccumulate Aggregate<TSource, TAccumulate>(this IQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> func)
|
||||
{
|
||||
Check.SourceAndFunc(source, func);
|
||||
return source.Provider.Execute<TAccumulate>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TAccumulate)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Constant(seed),
|
||||
Expression.Quote(func)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>The transformed final accumulator value.</returns>
|
||||
/// <param name="source">A sequence to aggregate over.</param>
|
||||
/// <param name="seed">The initial accumulator value.</param>
|
||||
/// <param name="func">An accumulator function to invoke on each element.</param>
|
||||
/// <param name="selector">A function to transform the final accumulator value into the result value.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TAccumulate">The type of the accumulator value.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the resulting value.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="func" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060003AA RID: 938 RVA: 0x0001114C File Offset: 0x0000F34C
|
||||
public static TResult Aggregate<TSource, TAccumulate, TResult>(this IQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> func, Expression<Func<TAccumulate, TResult>> selector)
|
||||
{
|
||||
Check.SourceAndFuncAndSelector(source, func, selector);
|
||||
return source.Provider.Execute<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TAccumulate),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Constant(seed),
|
||||
Expression.Quote(func),
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Determines whether all the elements of a sequence satisfy a condition.</summary>
|
||||
/// <returns>true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false.</returns>
|
||||
/// <param name="source">A sequence whose elements to test for a condition.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x060003AB RID: 939 RVA: 0x000111D8 File Offset: 0x0000F3D8
|
||||
public static bool All<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.Execute<bool>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Determines whether a sequence contains any elements.</summary>
|
||||
/// <returns>true if the source sequence contains any elements; otherwise, false.</returns>
|
||||
/// <param name="source">A sequence to check for being empty.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003AC RID: 940 RVA: 0x00011234 File Offset: 0x0000F434
|
||||
public static bool Any<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<bool>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Determines whether any element of a sequence satisfies a condition.</summary>
|
||||
/// <returns>true if any elements in the source sequence pass the test in the specified predicate; otherwise, false.</returns>
|
||||
/// <param name="source">A sequence whose elements to test for a condition.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x060003AD RID: 941 RVA: 0x00011284 File Offset: 0x0000F484
|
||||
public static bool Any<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.Execute<bool>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Converts a generic <see cref="T:System.Collections.Generic.IEnumerable`1" /> to a generic <see cref="T:System.Linq.IQueryable`1" />.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that represents the input sequence.</returns>
|
||||
/// <param name="source">A sequence to convert.</param>
|
||||
/// <typeparam name="TElement">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003AE RID: 942 RVA: 0x000112E0 File Offset: 0x0000F4E0
|
||||
public static IQueryable<TElement> AsQueryable<TElement>(this IEnumerable<TElement> source)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
IQueryable<TElement> queryable = source as IQueryable<TElement>;
|
||||
if (queryable != null)
|
||||
{
|
||||
return queryable;
|
||||
}
|
||||
return new QueryableEnumerable<TElement>(source);
|
||||
}
|
||||
|
||||
/// <summary>Converts an <see cref="T:System.Collections.IEnumerable" /> to an <see cref="T:System.Linq.IQueryable" />.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable" /> that represents the input sequence.</returns>
|
||||
/// <param name="source">A sequence to convert.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="source" /> does not implement <see cref="T:System.Collections.Generic.IEnumerable`1" /> for some <paramref name="T" />.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003AF RID: 943 RVA: 0x00011314 File Offset: 0x0000F514
|
||||
public static IQueryable AsQueryable(this IEnumerable source)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
throw new ArgumentNullException("source");
|
||||
}
|
||||
IQueryable queryable = source as IQueryable;
|
||||
if (queryable != null)
|
||||
{
|
||||
return queryable;
|
||||
}
|
||||
Type type = source.GetType();
|
||||
if (!type.IsGenericImplementationOf(typeof(IEnumerable<>)))
|
||||
{
|
||||
throw new ArgumentException("source is not IEnumerable<>");
|
||||
}
|
||||
return (IQueryable)Activator.CreateInstance(typeof(QueryableEnumerable<>).MakeGenericType(new Type[] { type.GetFirstGenericArgument() }), new object[] { source });
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Int32" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Int32" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060003B0 RID: 944 RVA: 0x0001139C File Offset: 0x0000F59C
|
||||
public static double Average(this IQueryable<int> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<double>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Int32" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only null values.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003B1 RID: 945 RVA: 0x000113D8 File Offset: 0x0000F5D8
|
||||
public static double? Average(this IQueryable<int?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<double?>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Int64" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Int64" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060003B2 RID: 946 RVA: 0x00011414 File Offset: 0x0000F614
|
||||
public static double Average(this IQueryable<long> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<double>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Int64" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only null values.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003B3 RID: 947 RVA: 0x00011450 File Offset: 0x0000F650
|
||||
public static double? Average(this IQueryable<long?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<double?>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Single" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Single" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060003B4 RID: 948 RVA: 0x0001148C File Offset: 0x0000F68C
|
||||
public static float Average(this IQueryable<float> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<float>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Single" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only null values.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003B5 RID: 949 RVA: 0x000114C8 File Offset: 0x0000F6C8
|
||||
public static float? Average(this IQueryable<float?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<float?>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Double" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Double" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060003B6 RID: 950 RVA: 0x00011504 File Offset: 0x0000F704
|
||||
public static double Average(this IQueryable<double> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<double>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Double" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only null values.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003B7 RID: 951 RVA: 0x00011540 File Offset: 0x0000F740
|
||||
public static double? Average(this IQueryable<double?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<double?>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Decimal" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060003B8 RID: 952 RVA: 0x0001157C File Offset: 0x0000F77C
|
||||
public static decimal Average(this IQueryable<decimal> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<decimal>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Decimal" /> values.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the source sequence is empty or contains only null values.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to calculate the average of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003B9 RID: 953 RVA: 0x000115B8 File Offset: 0x0000F7B8
|
||||
public static decimal? Average(this IQueryable<decimal?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<decimal?>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Int32" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060003BA RID: 954 RVA: 0x000115F4 File Offset: 0x0000F7F4
|
||||
public static double Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<double>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Int32" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the <paramref name="source" /> sequence is empty or contains only null values.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060003BB RID: 955 RVA: 0x00011650 File Offset: 0x0000F850
|
||||
public static double? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<double?>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Int64" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060003BC RID: 956 RVA: 0x000116AC File Offset: 0x0000F8AC
|
||||
public static double Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, long>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<double>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Int64" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the <paramref name="source" /> sequence is empty or contains only null values.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060003BD RID: 957 RVA: 0x00011708 File Offset: 0x0000F908
|
||||
public static double? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<double?>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Single" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060003BE RID: 958 RVA: 0x00011764 File Offset: 0x0000F964
|
||||
public static float Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, float>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<float>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Single" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the <paramref name="source" /> sequence is empty or contains only null values.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060003BF RID: 959 RVA: 0x000117C0 File Offset: 0x0000F9C0
|
||||
public static float? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<float?>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Double" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060003C0 RID: 960 RVA: 0x0001181C File Offset: 0x0000FA1C
|
||||
public static double Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, double>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<double>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Double" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the <paramref name="source" /> sequence is empty or contains only null values.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060003C1 RID: 961 RVA: 0x00011878 File Offset: 0x0000FA78
|
||||
public static double? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<double?>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of <see cref="T:System.Decimal" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values.</returns>
|
||||
/// <param name="source">A sequence of values that are used to calculate an average.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> contains no elements.</exception>
|
||||
// Token: 0x060003C2 RID: 962 RVA: 0x000118D4 File Offset: 0x0000FAD4
|
||||
public static decimal Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<decimal>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the average of a sequence of nullable <see cref="T:System.Decimal" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The average of the sequence of values, or null if the <paramref name="source" /> sequence is empty or contains only null values.</returns>
|
||||
/// <param name="source">A sequence of values to calculate the average of.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060003C3 RID: 963 RVA: 0x00011930 File Offset: 0x0000FB30
|
||||
public static decimal? Average<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<decimal?>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Converts the elements of an <see cref="T:System.Linq.IQueryable" /> to the specified type.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains each element of the source sequence converted to the specified type.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Linq.IQueryable" /> that contains the elements to be converted.</param>
|
||||
/// <typeparam name="TResult">The type to convert the elements of <paramref name="source" /> to.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidCastException">An element in the sequence cannot be cast to type <paramref name="TResult" />.</exception>
|
||||
// Token: 0x060003C4 RID: 964 RVA: 0x0001198C File Offset: 0x0000FB8C
|
||||
public static IQueryable<TResult> Cast<TResult>(this IQueryable source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return (IQueryable<TResult>)source.Provider.CreateQuery(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TResult) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Concatenates two sequences.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains the concatenated elements of the two input sequences.</returns>
|
||||
/// <param name="source1">The first sequence to concatenate.</param>
|
||||
/// <param name="source2">The sequence to concatenate to the first sequence.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source1" /> or <paramref name="source2" /> is null.</exception>
|
||||
// Token: 0x060003C5 RID: 965 RVA: 0x000119E0 File Offset: 0x0000FBE0
|
||||
public static IQueryable<TSource> Concat<TSource>(this IQueryable<TSource> source1, IEnumerable<TSource> source2)
|
||||
{
|
||||
Check.Source1AndSource2(source1, source2);
|
||||
return source1.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source1.Expression,
|
||||
Expression.Constant(source2)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Determines whether a sequence contains a specified element by using the default equality comparer.</summary>
|
||||
/// <returns>true if the input sequence contains an element that has the specified value; otherwise, false.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> in which to locate <paramref name="item" />.</param>
|
||||
/// <param name="item">The object to locate in the sequence.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003C6 RID: 966 RVA: 0x00011A3C File Offset: 0x0000FC3C
|
||||
public static bool Contains<TSource>(this IQueryable<TSource> source, TSource item)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<bool>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Constant(item)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Determines whether a sequence contains a specified element by using a specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" />.</summary>
|
||||
/// <returns>true if the input sequence contains an element that has the specified value; otherwise, false.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> in which to locate <paramref name="item" />.</param>
|
||||
/// <param name="item">The object to locate in the sequence.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003C7 RID: 967 RVA: 0x00011A9C File Offset: 0x0000FC9C
|
||||
public static bool Contains<TSource>(this IQueryable<TSource> source, TSource item, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<bool>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Constant(item),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Returns the number of elements in a sequence.</summary>
|
||||
/// <returns>The number of elements in the input sequence.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Linq.IQueryable`1" /> that contains the elements to be counted.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The number of elements in <paramref name="source" /> is larger than <see cref="F:System.Int32.MaxValue" />.</exception>
|
||||
// Token: 0x060003C8 RID: 968 RVA: 0x00011B04 File Offset: 0x0000FD04
|
||||
public static int Count<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Execute(MethodBase.GetCurrentMethod());
|
||||
}
|
||||
|
||||
/// <summary>Returns the number of elements in the specified sequence that satisfies a condition.</summary>
|
||||
/// <returns>The number of elements in the sequence that satisfies the condition in the predicate function.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> that contains the elements to be counted.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The number of elements in <paramref name="source" /> is larger than <see cref="F:System.Int32.MaxValue" />.</exception>
|
||||
// Token: 0x060003C9 RID: 969 RVA: 0x00011B18 File Offset: 0x0000FD18
|
||||
public static int Count<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.Execute<int>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains default(<paramref name="TSource" />) if <paramref name="source" /> is empty; otherwise, <paramref name="source" />.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Linq.IQueryable`1" /> to return a default value for if empty.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003CA RID: 970 RVA: 0x00011B74 File Offset: 0x0000FD74
|
||||
public static IQueryable<TSource> DefaultIfEmpty<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains <paramref name="defaultValue" /> if <paramref name="source" /> is empty; otherwise, <paramref name="source" />.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Linq.IQueryable`1" /> to return the specified value for if empty.</param>
|
||||
/// <param name="defaultValue">The value to return if the sequence is empty.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003CB RID: 971 RVA: 0x00011BC4 File Offset: 0x0000FDC4
|
||||
public static IQueryable<TSource> DefaultIfEmpty<TSource>(this IQueryable<TSource> source, TSource defaultValue)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Constant(defaultValue)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Returns distinct elements from a sequence by using the default equality comparer to compare values.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains distinct elements from <paramref name="source" />.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Linq.IQueryable`1" /> to remove duplicates from.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003CC RID: 972 RVA: 0x00011C24 File Offset: 0x0000FE24
|
||||
public static IQueryable<TSource> Distinct<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Returns distinct elements from a sequence by using a specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains distinct elements from <paramref name="source" />.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Linq.IQueryable`1" /> to remove duplicates from.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="comparer" /> is null.</exception>
|
||||
// Token: 0x060003CD RID: 973 RVA: 0x00011C74 File Offset: 0x0000FE74
|
||||
public static IQueryable<TSource> Distinct<TSource>(this IQueryable<TSource> source, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Returns the element at a specified index in a sequence.</summary>
|
||||
/// <returns>The element at the specified position in <paramref name="source" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return an element from.</param>
|
||||
/// <param name="index">The zero-based index of the element to retrieve.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> is less than zero.</exception>
|
||||
// Token: 0x060003CE RID: 974 RVA: 0x00011CCC File Offset: 0x0000FECC
|
||||
public static TSource ElementAt<TSource>(this IQueryable<TSource> source, int index)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Constant(index)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Returns the element at a specified index in a sequence or a default value if the index is out of range.</summary>
|
||||
/// <returns>default(<paramref name="TSource" />) if <paramref name="index" /> is outside the bounds of <paramref name="source" />; otherwise, the element at the specified position in <paramref name="source" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return an element from.</param>
|
||||
/// <param name="index">The zero-based index of the element to retrieve.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003CF RID: 975 RVA: 0x00011D2C File Offset: 0x0000FF2C
|
||||
public static TSource ElementAtOrDefault<TSource>(this IQueryable<TSource> source, int index)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Constant(index)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Produces the set difference of two sequences by using the default equality comparer to compare values.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains the set difference of the two sequences.</returns>
|
||||
/// <param name="source1">An <see cref="T:System.Linq.IQueryable`1" /> whose elements that are not also in <paramref name="source2" /> will be returned.</param>
|
||||
/// <param name="source2">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements that also occur in the first sequence will not appear in the returned sequence.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source1" /> or <paramref name="source2" /> is null.</exception>
|
||||
// Token: 0x060003D0 RID: 976 RVA: 0x00011D8C File Offset: 0x0000FF8C
|
||||
public static IQueryable<TSource> Except<TSource>(this IQueryable<TSource> source1, IEnumerable<TSource> source2)
|
||||
{
|
||||
Check.Source1AndSource2(source1, source2);
|
||||
return source1.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source1.Expression,
|
||||
Expression.Constant(source2)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Produces the set difference of two sequences by using the specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains the set difference of the two sequences.</returns>
|
||||
/// <param name="source1">An <see cref="T:System.Linq.IQueryable`1" /> whose elements that are not also in <paramref name="source2" /> will be returned.</param>
|
||||
/// <param name="source2">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements that also occur in the first sequence will not appear in the returned sequence.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source1" /> or <paramref name="source2" /> is null.</exception>
|
||||
// Token: 0x060003D1 RID: 977 RVA: 0x00011DE8 File Offset: 0x0000FFE8
|
||||
public static IQueryable<TSource> Except<TSource>(this IQueryable<TSource> source1, IEnumerable<TSource> source2, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
Check.Source1AndSource2(source1, source2);
|
||||
return source1.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source1.Expression,
|
||||
Expression.Constant(source2),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Returns the first element of a sequence.</summary>
|
||||
/// <returns>The first element in <paramref name="source" />.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Linq.IQueryable`1" /> to return the first element of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The source sequence is empty.</exception>
|
||||
// Token: 0x060003D2 RID: 978 RVA: 0x00011E4C File Offset: 0x0001004C
|
||||
public static TSource First<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Returns the first element of a sequence that satisfies a specified condition.</summary>
|
||||
/// <returns>The first element in <paramref name="source" /> that passes the test in <paramref name="predicate" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return an element from.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">No element satisfies the condition in <paramref name="predicate" />.-or-The source sequence is empty.</exception>
|
||||
// Token: 0x060003D3 RID: 979 RVA: 0x00011E9C File Offset: 0x0001009C
|
||||
public static TSource First<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Returns the first element of a sequence, or a default value if the sequence contains no elements.</summary>
|
||||
/// <returns>default(<paramref name="TSource" />) if <paramref name="source" /> is empty; otherwise, the first element in <paramref name="source" />.</returns>
|
||||
/// <param name="source">The <see cref="T:System.Linq.IQueryable`1" /> to return the first element of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003D4 RID: 980 RVA: 0x00011EF8 File Offset: 0x000100F8
|
||||
public static TSource FirstOrDefault<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Returns the first element of a sequence that satisfies a specified condition or a default value if no such element is found.</summary>
|
||||
/// <returns>default(<paramref name="TSource" />) if <paramref name="source" /> is empty or if no element passes the test specified by <paramref name="predicate" />; otherwise, the first element in <paramref name="source" /> that passes the test specified by <paramref name="predicate" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return an element from.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x060003D5 RID: 981 RVA: 0x00011F48 File Offset: 0x00010148
|
||||
public static TSource FirstOrDefault<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Groups the elements of a sequence according to a specified key selector function.</summary>
|
||||
/// <returns>An IQueryable<IGrouping<TKey, TSource>> in C# or IQueryable(Of IGrouping(Of TKey, TSource)) in Visual Basic where each <see cref="T:System.Linq.IGrouping`2" /> object contains a sequence of objects and a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function represented in <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x060003D6 RID: 982 RVA: 0x00011FA4 File Offset: 0x000101A4
|
||||
public static IQueryable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return source.Provider.CreateQuery<IGrouping<TKey, TSource>>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Groups the elements of a sequence according to a specified key selector function and compares the keys by using a specified comparer.</summary>
|
||||
/// <returns>An IQueryable<IGrouping<TKey, TSource>> in C# or IQueryable(Of IGrouping(Of TKey, TSource)) in Visual Basic where each <see cref="T:System.Linq.IGrouping`2" /> contains a sequence of objects and a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function represented in <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
|
||||
// Token: 0x060003D7 RID: 983 RVA: 0x0001200C File Offset: 0x0001020C
|
||||
public static IQueryable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return source.Provider.CreateQuery<IGrouping<TKey, TSource>>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>An IQueryable<IGrouping<TKey, TElement>> in C# or IQueryable(Of IGrouping(Of TKey, TElement)) in Visual Basic where each <see cref="T:System.Linq.IGrouping`2" /> contains a sequence of objects of type <paramref name="TElement" /> and a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <param name="elementSelector">A function to map each source element to an element in an <see cref="T:System.Linq.IGrouping`2" />.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function represented in <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the elements in each <see cref="T:System.Linq.IGrouping`2" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> is null.</exception>
|
||||
// Token: 0x060003D8 RID: 984 RVA: 0x0001207C File Offset: 0x0001027C
|
||||
public static IQueryable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
|
||||
{
|
||||
Check.SourceAndKeyElementSelectors(source, keySelector, elementSelector);
|
||||
return source.Provider.CreateQuery<IGrouping<TKey, TElement>>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey),
|
||||
typeof(TElement)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector),
|
||||
Expression.Quote(elementSelector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key.</summary>
|
||||
/// <returns>An T:System.Linq.IQueryable`1 that has a type argument of <paramref name="TResult" /> and where each element represents a projection over a group and its key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <param name="resultSelector">A function to create a result value from each group.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function represented in <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result value returned by <paramref name="resultSelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x060003D9 RID: 985 RVA: 0x000120FC File Offset: 0x000102FC
|
||||
public static IQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector)
|
||||
{
|
||||
Check.SourceAndKeyResultSelectors(source, keySelector, resultSelector);
|
||||
return source.Provider.CreateQuery<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector),
|
||||
Expression.Quote(resultSelector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Groups the elements of a sequence and projects the elements for each group by using a specified function. Key values are compared by using a specified comparer.</summary>
|
||||
/// <returns>An IQueryable<IGrouping<TKey, TElement>> in C# or IQueryable(Of IGrouping(Of TKey, TElement)) in Visual Basic where each <see cref="T:System.Linq.IGrouping`2" /> contains a sequence of objects of type <paramref name="TElement" /> and a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <param name="elementSelector">A function to map each source element to an element in an <see cref="T:System.Linq.IGrouping`2" />.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function represented in <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the elements in each <see cref="T:System.Linq.IGrouping`2" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="comparer" /> is null.</exception>
|
||||
// Token: 0x060003DA RID: 986 RVA: 0x0001217C File Offset: 0x0001037C
|
||||
public static IQueryable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeyElementSelectors(source, keySelector, elementSelector);
|
||||
return source.Provider.CreateQuery<IGrouping<TKey, TElement>>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey),
|
||||
typeof(TElement)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector),
|
||||
Expression.Quote(elementSelector),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>An T:System.Linq.IQueryable`1 that has a type argument of <paramref name="TResult" /> and where each element represents a projection over a group and its key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <param name="elementSelector">A function to map each source element to an element in an <see cref="T:System.Linq.IGrouping`2" />.</param>
|
||||
/// <param name="resultSelector">A function to create a result value from each group.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function represented in <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the elements in each <see cref="T:System.Linq.IGrouping`2" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result value returned by <paramref name="resultSelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x060003DB RID: 987 RVA: 0x00012204 File Offset: 0x00010404
|
||||
public static IQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<TKey, IEnumerable<TElement>, TResult>> resultSelector)
|
||||
{
|
||||
Check.GroupBySelectors(source, keySelector, elementSelector, resultSelector);
|
||||
return source.Provider.CreateQuery<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey),
|
||||
typeof(TElement),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector),
|
||||
Expression.Quote(elementSelector),
|
||||
Expression.Quote(resultSelector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Keys are compared by using a specified comparer.</summary>
|
||||
/// <returns>An T:System.Linq.IQueryable`1 that has a type argument of <paramref name="TResult" /> and where each element represents a projection over a group and its key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <param name="resultSelector">A function to create a result value from each group.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function represented in <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result value returned by <paramref name="resultSelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="resultSelector" /> or <paramref name="comparer" /> is null.</exception>
|
||||
// Token: 0x060003DC RID: 988 RVA: 0x00012298 File Offset: 0x00010498
|
||||
public static IQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeyResultSelectors(source, keySelector, resultSelector);
|
||||
return source.Provider.CreateQuery<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector),
|
||||
Expression.Quote(resultSelector),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Keys are compared by using a specified comparer and the elements of each group are projected by using a specified function.</summary>
|
||||
/// <returns>An T:System.Linq.IQueryable`1 that has a type argument of <paramref name="TResult" /> and where each element represents a projection over a group and its key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> whose elements to group.</param>
|
||||
/// <param name="keySelector">A function to extract the key for each element.</param>
|
||||
/// <param name="elementSelector">A function to map each source element to an element in an <see cref="T:System.Linq.IGrouping`2" />.</param>
|
||||
/// <param name="resultSelector">A function to create a result value from each group.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function represented in <paramref name="keySelector" />.</typeparam>
|
||||
/// <typeparam name="TElement">The type of the elements in each <see cref="T:System.Linq.IGrouping`2" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result value returned by <paramref name="resultSelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="elementSelector" /> or <paramref name="resultSelector" /> or <paramref name="comparer" /> is null.</exception>
|
||||
// Token: 0x060003DD RID: 989 RVA: 0x00012320 File Offset: 0x00010520
|
||||
public static IQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<TKey, IEnumerable<TElement>, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
Check.GroupBySelectors(source, keySelector, elementSelector, resultSelector);
|
||||
return source.Provider.CreateQuery<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey),
|
||||
typeof(TElement),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector),
|
||||
Expression.Quote(elementSelector),
|
||||
Expression.Quote(resultSelector),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Correlates the elements of two sequences based on key equality and groups the results. The default equality comparer is used to compare keys.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains elements of type <paramref name="TResult" /> obtained by performing a grouped join on two sequences.</returns>
|
||||
/// <param name="outer">The first sequence to join.</param>
|
||||
/// <param name="inner">The sequence to join to the first sequence.</param>
|
||||
/// <param name="outerKeySelector">A function to extract the join key from each element of the first sequence.</param>
|
||||
/// <param name="innerKeySelector">A function to extract the join key from each element of the second sequence.</param>
|
||||
/// <param name="resultSelector">A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.</param>
|
||||
/// <typeparam name="TOuter">The type of the elements of the first sequence.</typeparam>
|
||||
/// <typeparam name="TInner">The type of the elements of the second sequence.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the keys returned by the key selector functions.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result elements.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="outer" /> or <paramref name="inner" /> or <paramref name="outerKeySelector" /> or <paramref name="innerKeySelector" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x060003DE RID: 990 RVA: 0x000123C0 File Offset: 0x000105C0
|
||||
public static IQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, IEnumerable<TInner>, TResult>> resultSelector)
|
||||
{
|
||||
if (outer == null)
|
||||
{
|
||||
throw new ArgumentNullException("outer");
|
||||
}
|
||||
if (inner == null)
|
||||
{
|
||||
throw new ArgumentNullException("inner");
|
||||
}
|
||||
if (outerKeySelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("outerKeySelector");
|
||||
}
|
||||
if (innerKeySelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("innerKeySelector");
|
||||
}
|
||||
if (resultSelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("resultSelector");
|
||||
}
|
||||
return outer.Provider.CreateQuery<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TOuter),
|
||||
typeof(TInner),
|
||||
typeof(TKey),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
outer.Expression,
|
||||
Expression.Constant(inner),
|
||||
Expression.Quote(outerKeySelector),
|
||||
Expression.Quote(innerKeySelector),
|
||||
Expression.Quote(resultSelector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Correlates the elements of two sequences based on key equality and groups the results. A specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> is used to compare keys.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains elements of type <paramref name="TResult" /> obtained by performing a grouped join on two sequences.</returns>
|
||||
/// <param name="outer">The first sequence to join.</param>
|
||||
/// <param name="inner">The sequence to join to the first sequence.</param>
|
||||
/// <param name="outerKeySelector">A function to extract the join key from each element of the first sequence.</param>
|
||||
/// <param name="innerKeySelector">A function to extract the join key from each element of the second sequence.</param>
|
||||
/// <param name="resultSelector">A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.</param>
|
||||
/// <param name="comparer">A comparer to hash and compare keys.</param>
|
||||
/// <typeparam name="TOuter">The type of the elements of the first sequence.</typeparam>
|
||||
/// <typeparam name="TInner">The type of the elements of the second sequence.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the keys returned by the key selector functions.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result elements.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="outer" /> or <paramref name="inner" /> or <paramref name="outerKeySelector" /> or <paramref name="innerKeySelector" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x060003DF RID: 991 RVA: 0x000124AC File Offset: 0x000106AC
|
||||
public static IQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, IEnumerable<TInner>, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
if (outer == null)
|
||||
{
|
||||
throw new ArgumentNullException("outer");
|
||||
}
|
||||
if (inner == null)
|
||||
{
|
||||
throw new ArgumentNullException("inner");
|
||||
}
|
||||
if (outerKeySelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("outerKeySelector");
|
||||
}
|
||||
if (innerKeySelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("innerKeySelector");
|
||||
}
|
||||
if (resultSelector == null)
|
||||
{
|
||||
throw new ArgumentNullException("resultSelector");
|
||||
}
|
||||
return outer.Provider.CreateQuery<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TOuter),
|
||||
typeof(TInner),
|
||||
typeof(TKey),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
outer.Expression,
|
||||
Expression.Constant(inner),
|
||||
Expression.Quote(outerKeySelector),
|
||||
Expression.Quote(innerKeySelector),
|
||||
Expression.Quote(resultSelector),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Produces the set intersection of two sequences by using the default equality comparer to compare values.</summary>
|
||||
/// <returns>A sequence that contains the set intersection of the two sequences.</returns>
|
||||
/// <param name="source1">A sequence whose distinct elements that also appear in <paramref name="source2" /> are returned.</param>
|
||||
/// <param name="source2">A sequence whose distinct elements that also appear in the first sequence are returned.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source1" /> or <paramref name="source2" /> is null.</exception>
|
||||
// Token: 0x060003E0 RID: 992 RVA: 0x000125A4 File Offset: 0x000107A4
|
||||
public static IQueryable<TSource> Intersect<TSource>(this IQueryable<TSource> source1, IEnumerable<TSource> source2)
|
||||
{
|
||||
Check.Source1AndSource2(source1, source2);
|
||||
return source1.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source1.Expression,
|
||||
Expression.Constant(source2)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Produces the set intersection of two sequences by using the specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains the set intersection of the two sequences.</returns>
|
||||
/// <param name="source1">An <see cref="T:System.Linq.IQueryable`1" /> whose distinct elements that also appear in <paramref name="source2" /> are returned.</param>
|
||||
/// <param name="source2">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose distinct elements that also appear in the first sequence are returned.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source1" /> or <paramref name="source2" /> is null.</exception>
|
||||
// Token: 0x060003E1 RID: 993 RVA: 0x00012600 File Offset: 0x00010800
|
||||
public static IQueryable<TSource> Intersect<TSource>(this IQueryable<TSource> source1, IEnumerable<TSource> source2, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
Check.Source1AndSource2(source1, source2);
|
||||
return source1.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source1.Expression,
|
||||
Expression.Constant(source2),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that has elements of type <paramref name="TResult" /> obtained by performing an inner join on two sequences.</returns>
|
||||
/// <param name="outer">The first sequence to join.</param>
|
||||
/// <param name="inner">The sequence to join to the first sequence.</param>
|
||||
/// <param name="outerKeySelector">A function to extract the join key from each element of the first sequence.</param>
|
||||
/// <param name="innerKeySelector">A function to extract the join key from each element of the second sequence.</param>
|
||||
/// <param name="resultSelector">A function to create a result element from two matching elements.</param>
|
||||
/// <typeparam name="TOuter">The type of the elements of the first sequence.</typeparam>
|
||||
/// <typeparam name="TInner">The type of the elements of the second sequence.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the keys returned by the key selector functions.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result elements.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="outer" /> or <paramref name="inner" /> or <paramref name="outerKeySelector" /> or <paramref name="innerKeySelector" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x060003E2 RID: 994 RVA: 0x00012664 File Offset: 0x00010864
|
||||
public static IQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector)
|
||||
{
|
||||
Check.JoinSelectors(outer, inner, outerKeySelector, innerKeySelector, resultSelector);
|
||||
return outer.Provider.CreateQuery<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TOuter),
|
||||
typeof(TInner),
|
||||
typeof(TKey),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
outer.Expression,
|
||||
Expression.Constant(inner),
|
||||
Expression.Quote(outerKeySelector),
|
||||
Expression.Quote(innerKeySelector),
|
||||
Expression.Quote(resultSelector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Correlates the elements of two sequences based on matching keys. A specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> is used to compare keys.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that has elements of type <paramref name="TResult" /> obtained by performing an inner join on two sequences.</returns>
|
||||
/// <param name="outer">The first sequence to join.</param>
|
||||
/// <param name="inner">The sequence to join to the first sequence.</param>
|
||||
/// <param name="outerKeySelector">A function to extract the join key from each element of the first sequence.</param>
|
||||
/// <param name="innerKeySelector">A function to extract the join key from each element of the second sequence.</param>
|
||||
/// <param name="resultSelector">A function to create a result element from two matching elements.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to hash and compare keys.</param>
|
||||
/// <typeparam name="TOuter">The type of the elements of the first sequence.</typeparam>
|
||||
/// <typeparam name="TInner">The type of the elements of the second sequence.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the keys returned by the key selector functions.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the result elements.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="outer" /> or <paramref name="inner" /> or <paramref name="outerKeySelector" /> or <paramref name="innerKeySelector" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x060003E3 RID: 995 RVA: 0x00012704 File Offset: 0x00010904
|
||||
public static IQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer, IEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
Check.JoinSelectors(outer, inner, outerKeySelector, innerKeySelector, resultSelector);
|
||||
return outer.Provider.CreateQuery<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TOuter),
|
||||
typeof(TInner),
|
||||
typeof(TKey),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
outer.Expression,
|
||||
Expression.Constant(inner),
|
||||
Expression.Quote(outerKeySelector),
|
||||
Expression.Quote(innerKeySelector),
|
||||
Expression.Quote(resultSelector),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Returns the last element in a sequence.</summary>
|
||||
/// <returns>The value at the last position in <paramref name="source" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return the last element of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The source sequence is empty.</exception>
|
||||
// Token: 0x060003E4 RID: 996 RVA: 0x000127B0 File Offset: 0x000109B0
|
||||
public static TSource Last<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Returns the last element of a sequence that satisfies a specified condition.</summary>
|
||||
/// <returns>The last element in <paramref name="source" /> that passes the test specified by <paramref name="predicate" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return an element from.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">No element satisfies the condition in <paramref name="predicate" />.-or-The source sequence is empty.</exception>
|
||||
// Token: 0x060003E5 RID: 997 RVA: 0x00012800 File Offset: 0x00010A00
|
||||
public static TSource Last<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Returns the last element in a sequence, or a default value if the sequence contains no elements.</summary>
|
||||
/// <returns>default(<paramref name="TSource" />) if <paramref name="source" /> is empty; otherwise, the last element in <paramref name="source" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return the last element of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003E6 RID: 998 RVA: 0x0001285C File Offset: 0x00010A5C
|
||||
public static TSource LastOrDefault<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Returns the last element of a sequence that satisfies a condition or a default value if no such element is found.</summary>
|
||||
/// <returns>default(<paramref name="TSource" />) if <paramref name="source" /> is empty or if no elements pass the test in the predicate function; otherwise, the last element of <paramref name="source" /> that passes the test in the predicate function.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return an element from.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x060003E7 RID: 999 RVA: 0x000128AC File Offset: 0x00010AAC
|
||||
public static TSource LastOrDefault<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Returns an <see cref="T:System.Int64" /> that represents the total number of elements in a sequence.</summary>
|
||||
/// <returns>The number of elements in <paramref name="source" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> that contains the elements to be counted.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The number of elements exceeds <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x060003E8 RID: 1000 RVA: 0x00012908 File Offset: 0x00010B08
|
||||
public static long LongCount<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Execute(MethodBase.GetCurrentMethod());
|
||||
}
|
||||
|
||||
/// <summary>Returns an <see cref="T:System.Int64" /> that represents the number of elements in a sequence that satisfy a condition.</summary>
|
||||
/// <returns>The number of elements in <paramref name="source" /> that satisfy the condition in the predicate function.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> that contains the elements to be counted.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The number of matching elements exceeds <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x060003E9 RID: 1001 RVA: 0x0001291C File Offset: 0x00010B1C
|
||||
public static long LongCount<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.Execute<long>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Returns the maximum value in a generic <see cref="T:System.Linq.IQueryable`1" />.</summary>
|
||||
/// <returns>The maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the maximum of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003EA RID: 1002 RVA: 0x00012978 File Offset: 0x00010B78
|
||||
public static TSource Max<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Invokes a projection function on each element of a generic <see cref="T:System.Linq.IQueryable`1" /> and returns the maximum resulting value.</summary>
|
||||
/// <returns>The maximum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the maximum of.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the value returned by the function represented by <paramref name="selector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060003EB RID: 1003 RVA: 0x000129C8 File Offset: 0x00010BC8
|
||||
public static TResult Max<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Returns the minimum value of a generic <see cref="T:System.Linq.IQueryable`1" />.</summary>
|
||||
/// <returns>The minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the minimum of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003EC RID: 1004 RVA: 0x00012A30 File Offset: 0x00010C30
|
||||
public static TSource Min<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Invokes a projection function on each element of a generic <see cref="T:System.Linq.IQueryable`1" /> and returns the minimum resulting value.</summary>
|
||||
/// <returns>The minimum value in the sequence.</returns>
|
||||
/// <param name="source">A sequence of values to determine the minimum of.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the value returned by the function represented by <paramref name="selector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060003ED RID: 1005 RVA: 0x00012A80 File Offset: 0x00010C80
|
||||
public static TResult Min<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Filters the elements of an <see cref="T:System.Linq.IQueryable" /> based on a specified type.</summary>
|
||||
/// <returns>A collection that contains the elements from <paramref name="source" /> that have type <paramref name="TResult" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable" /> whose elements to filter.</param>
|
||||
/// <typeparam name="TResult">The type to filter the elements of the sequence on.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003EE RID: 1006 RVA: 0x00012AE8 File Offset: 0x00010CE8
|
||||
public static IQueryable<TResult> OfType<TResult>(this IQueryable source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return (IQueryable<TResult>)source.Provider.CreateQuery(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TResult) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Sorts the elements of a sequence in ascending order according to a key.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedQueryable`1" /> whose elements are sorted according to a key.</returns>
|
||||
/// <param name="source">A sequence of values to order.</param>
|
||||
/// <param name="keySelector">A function to extract a key from an element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function that is represented by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x060003EF RID: 1007 RVA: 0x00012B3C File Offset: 0x00010D3C
|
||||
public static IOrderedQueryable<TSource> OrderBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Sorts the elements of a sequence in ascending order by using a specified comparer.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedQueryable`1" /> whose elements are sorted according to a key.</returns>
|
||||
/// <param name="source">A sequence of values to order.</param>
|
||||
/// <param name="keySelector">A function to extract a key from an element.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function that is represented by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
|
||||
// Token: 0x060003F0 RID: 1008 RVA: 0x00012BA8 File Offset: 0x00010DA8
|
||||
public static IOrderedQueryable<TSource> OrderBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Sorts the elements of a sequence in descending order according to a key.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedQueryable`1" /> whose elements are sorted in descending order according to a key.</returns>
|
||||
/// <param name="source">A sequence of values to order.</param>
|
||||
/// <param name="keySelector">A function to extract a key from an element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function that is represented by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x060003F1 RID: 1009 RVA: 0x00012C1C File Offset: 0x00010E1C
|
||||
public static IOrderedQueryable<TSource> OrderByDescending<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Sorts the elements of a sequence in descending order by using a specified comparer.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedQueryable`1" /> whose elements are sorted in descending order according to a key.</returns>
|
||||
/// <param name="source">A sequence of values to order.</param>
|
||||
/// <param name="keySelector">A function to extract a key from an element.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function that is represented by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
|
||||
// Token: 0x060003F2 RID: 1010 RVA: 0x00012C88 File Offset: 0x00010E88
|
||||
public static IOrderedQueryable<TSource> OrderByDescending<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Inverts the order of the elements in a sequence.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> whose elements correspond to those of the input sequence in reverse order.</returns>
|
||||
/// <param name="source">A sequence of values to reverse.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003F3 RID: 1011 RVA: 0x00012CFC File Offset: 0x00010EFC
|
||||
public static IQueryable<TSource> Reverse<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Projects each element of a sequence into a new form.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> whose elements are the result of invoking a projection function on each element of <paramref name="source" />.</returns>
|
||||
/// <param name="source">A sequence of values to project.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the value returned by the function represented by <paramref name="selector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060003F4 RID: 1012 RVA: 0x00012D4C File Offset: 0x00010F4C
|
||||
public static IQueryable<TResult> Select<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.CreateQuery<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Projects each element of a sequence into a new form by incorporating the element's index.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> whose elements are the result of invoking a projection function on each element of <paramref name="source" />.</returns>
|
||||
/// <param name="source">A sequence of values to project.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the value returned by the function represented by <paramref name="selector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060003F5 RID: 1013 RVA: 0x00012DB4 File Offset: 0x00010FB4
|
||||
public static IQueryable<TResult> Select<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, int, TResult>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.CreateQuery<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Projects each element of a sequence to an <see cref="T:System.Collections.Generic.IEnumerable`1" /> and combines the resulting sequences into one sequence.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> whose elements are the result of invoking a one-to-many projection function on each element of the input sequence.</returns>
|
||||
/// <param name="source">A sequence of values to project.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the elements of the sequence returned by the function represented by <paramref name="selector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060003F6 RID: 1014 RVA: 0x00012E1C File Offset: 0x0001101C
|
||||
public static IQueryable<TResult> SelectMany<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, IEnumerable<TResult>>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.CreateQuery<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Projects each element of a sequence to an <see cref="T:System.Collections.Generic.IEnumerable`1" /> and combines the resulting sequences into one sequence. The index of each source element is used in the projected form of that element.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> whose elements are the result of invoking a one-to-many projection function on each element of the input sequence.</returns>
|
||||
/// <param name="source">A sequence of values to project.</param>
|
||||
/// <param name="selector">A projection function to apply to each element; the second parameter of this function represents the index of the source element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the elements of the sequence returned by the function represented by <paramref name="selector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x060003F7 RID: 1015 RVA: 0x00012E84 File Offset: 0x00011084
|
||||
public static IQueryable<TResult> SelectMany<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, int, IEnumerable<TResult>>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.CreateQuery<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Projects each element of a sequence to an <see cref="T:System.Collections.Generic.IEnumerable`1" /> that incorporates the index of the source element that produced it. A result selector function is invoked on each element of each intermediate sequence, and the resulting values are combined into a single, one-dimensional sequence and returned.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> whose elements are the result of invoking the one-to-many projection function <paramref name="collectionSelector" /> on each element of <paramref name="source" /> and then mapping each of those sequence elements and their corresponding <paramref name="source" /> element to a result element.</returns>
|
||||
/// <param name="source">A sequence of values to project.</param>
|
||||
/// <param name="collectionSelector">A projection function to apply to each element of the input sequence; the second parameter of this function represents the index of the source element.</param>
|
||||
/// <param name="resultSelector">A projection function to apply to each element of each intermediate sequence.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TCollection">The type of the intermediate elements collected by the function represented by <paramref name="collectionSelector" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the elements of the resulting sequence.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="collectionSelector" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x060003F8 RID: 1016 RVA: 0x00012EEC File Offset: 0x000110EC
|
||||
public static IQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, int, IEnumerable<TCollection>>> collectionSelector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
|
||||
{
|
||||
Check.SourceAndCollectionSelectorAndResultSelector(source, collectionSelector, resultSelector);
|
||||
return source.Provider.CreateQuery<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TCollection),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(collectionSelector),
|
||||
Expression.Quote(resultSelector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Projects each element of a sequence to an <see cref="T:System.Collections.Generic.IEnumerable`1" /> and invokes a result selector function on each element therein. The resulting values from each intermediate sequence are combined into a single, one-dimensional sequence and returned.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> whose elements are the result of invoking the one-to-many projection function <paramref name="collectionSelector" /> on each element of <paramref name="source" /> and then mapping each of those sequence elements and their corresponding <paramref name="source" /> element to a result element.</returns>
|
||||
/// <param name="source">A sequence of values to project.</param>
|
||||
/// <param name="collectionSelector">A projection function to apply to each element of the input sequence.</param>
|
||||
/// <param name="resultSelector">A projection function to apply to each element of each intermediate sequence.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TCollection">The type of the intermediate elements collected by the function represented by <paramref name="collectionSelector" />.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the elements of the resulting sequence.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="collectionSelector" /> or <paramref name="resultSelector" /> is null.</exception>
|
||||
// Token: 0x060003F9 RID: 1017 RVA: 0x00012F6C File Offset: 0x0001116C
|
||||
public static IQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, IEnumerable<TCollection>>> collectionSelector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
|
||||
{
|
||||
Check.SourceAndCollectionSelectorAndResultSelector(source, collectionSelector, resultSelector);
|
||||
return source.Provider.CreateQuery<TResult>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TCollection),
|
||||
typeof(TResult)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(collectionSelector),
|
||||
Expression.Quote(resultSelector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Determines whether two sequences are equal by using the default equality comparer to compare elements.</summary>
|
||||
/// <returns>true if the two source sequences are of equal length and their corresponding elements compare equal; otherwise, false.</returns>
|
||||
/// <param name="source1">An <see cref="T:System.Linq.IQueryable`1" /> whose elements to compare to those of <paramref name="source2" />.</param>
|
||||
/// <param name="source2">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to compare to those of the first sequence.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source1" /> or <paramref name="source2" /> is null.</exception>
|
||||
// Token: 0x060003FA RID: 1018 RVA: 0x00012FEC File Offset: 0x000111EC
|
||||
public static bool SequenceEqual<TSource>(this IQueryable<TSource> source1, IEnumerable<TSource> source2)
|
||||
{
|
||||
Check.Source1AndSource2(source1, source2);
|
||||
return source1.Provider.Execute<bool>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source1.Expression,
|
||||
Expression.Constant(source2)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Determines whether two sequences are equal by using a specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare elements.</summary>
|
||||
/// <returns>true if the two source sequences are of equal length and their corresponding elements compare equal; otherwise, false.</returns>
|
||||
/// <param name="source1">An <see cref="T:System.Linq.IQueryable`1" /> whose elements to compare to those of <paramref name="source2" />.</param>
|
||||
/// <param name="source2">An <see cref="T:System.Collections.Generic.IEnumerable`1" /> whose elements to compare to those of the first sequence.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to use to compare elements.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source1" /> or <paramref name="source2" /> is null.</exception>
|
||||
// Token: 0x060003FB RID: 1019 RVA: 0x00013048 File Offset: 0x00011248
|
||||
public static bool SequenceEqual<TSource>(this IQueryable<TSource> source1, IEnumerable<TSource> source2, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
Check.Source1AndSource2(source1, source2);
|
||||
return source1.Provider.Execute<bool>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source1.Expression,
|
||||
Expression.Constant(source2),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.</summary>
|
||||
/// <returns>The single element of the input sequence.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return the single element of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <paramref name="source" /> has more than one element.</exception>
|
||||
// Token: 0x060003FC RID: 1020 RVA: 0x000130AC File Offset: 0x000112AC
|
||||
public static TSource Single<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.</summary>
|
||||
/// <returns>The single element of the input sequence that satisfies the condition in <paramref name="predicate" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return a single element from.</param>
|
||||
/// <param name="predicate">A function to test an element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">No element satisfies the condition in <paramref name="predicate" />.-or-More than one element satisfies the condition in <paramref name="predicate" />.-or-The source sequence is empty.</exception>
|
||||
// Token: 0x060003FD RID: 1021 RVA: 0x000130FC File Offset: 0x000112FC
|
||||
public static TSource Single<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>The single element of the input sequence, or default(<paramref name="TSource" />) if the sequence contains no elements.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return the single element of.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x060003FE RID: 1022 RVA: 0x00013158 File Offset: 0x00011358
|
||||
public static TSource SingleOrDefault<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>The single element of the input sequence that satisfies the condition in <paramref name="predicate" />, or default(<paramref name="TSource" />) if no such element is found.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return a single element from.</param>
|
||||
/// <param name="predicate">A function to test an element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x060003FF RID: 1023 RVA: 0x000131A8 File Offset: 0x000113A8
|
||||
public static TSource SingleOrDefault<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.Execute<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Bypasses a specified number of elements in a sequence and then returns the remaining elements.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains elements that occur after the specified index in the input sequence.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return elements from.</param>
|
||||
/// <param name="count">The number of elements to skip before returning the remaining elements.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x06000400 RID: 1024 RVA: 0x00013204 File Offset: 0x00011404
|
||||
public static IQueryable<TSource> Skip<TSource>(this IQueryable<TSource> source, int count)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Constant(count)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains elements from <paramref name="source" /> starting at the first element in the linear series that does not pass the test specified by <paramref name="predicate" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return elements from.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x06000401 RID: 1025 RVA: 0x00013264 File Offset: 0x00011464
|
||||
public static IQueryable<TSource> SkipWhile<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains elements from <paramref name="source" /> starting at the first element in the linear series that does not pass the test specified by <paramref name="predicate" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to return elements from.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition; the second parameter of this function represents the index of the source element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x06000402 RID: 1026 RVA: 0x000132C0 File Offset: 0x000114C0
|
||||
public static IQueryable<TSource> SkipWhile<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of <see cref="T:System.Int32" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values of type <paramref name="TSource" />.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int32.MaxValue" />.</exception>
|
||||
// Token: 0x06000403 RID: 1027 RVA: 0x0001331C File Offset: 0x0001151C
|
||||
public static int Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<int>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of nullable <see cref="T:System.Int32" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values of type <paramref name="TSource" />.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x06000404 RID: 1028 RVA: 0x00013378 File Offset: 0x00011578
|
||||
public static int? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<int?>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of <see cref="T:System.Int64" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values of type <paramref name="TSource" />.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x06000405 RID: 1029 RVA: 0x000133D4 File Offset: 0x000115D4
|
||||
public static long Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, long>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<long>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of nullable <see cref="T:System.Int64" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values of type <paramref name="TSource" />.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x06000406 RID: 1030 RVA: 0x00013430 File Offset: 0x00011630
|
||||
public static long? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<long?>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of <see cref="T:System.Single" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values of type <paramref name="TSource" />.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x06000407 RID: 1031 RVA: 0x0001348C File Offset: 0x0001168C
|
||||
public static float Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, float>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<float>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of nullable <see cref="T:System.Single" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values of type <paramref name="TSource" />.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x06000408 RID: 1032 RVA: 0x000134E8 File Offset: 0x000116E8
|
||||
public static float? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<float?>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of <see cref="T:System.Double" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values of type <paramref name="TSource" />.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
// Token: 0x06000409 RID: 1033 RVA: 0x00013544 File Offset: 0x00011744
|
||||
public static double Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, double>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<double>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of nullable <see cref="T:System.Double" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values of type <paramref name="TSource" />.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int32.MaxValue" />.</exception>
|
||||
// Token: 0x0600040A RID: 1034 RVA: 0x000135A0 File Offset: 0x000117A0
|
||||
public static double? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<double?>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of <see cref="T:System.Decimal" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values of type <paramref name="TSource" />.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Decimal.MaxValue" />.</exception>
|
||||
// Token: 0x0600040B RID: 1035 RVA: 0x000135FC File Offset: 0x000117FC
|
||||
public static decimal Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<decimal>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of the sequence of nullable <see cref="T:System.Decimal" /> values that is obtained by invoking a projection function on each element of the input sequence.</summary>
|
||||
/// <returns>The sum of the projected values.</returns>
|
||||
/// <param name="source">A sequence of values of type <paramref name="TSource" />.</param>
|
||||
/// <param name="selector">A projection function to apply to each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="selector" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Decimal.MaxValue" />.</exception>
|
||||
// Token: 0x0600040C RID: 1036 RVA: 0x00013658 File Offset: 0x00011858
|
||||
public static decimal? Sum<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
|
||||
{
|
||||
Check.SourceAndSelector(source, selector);
|
||||
return source.Provider.Execute<decimal?>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(selector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of <see cref="T:System.Int32" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Int32" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int32.MaxValue" />.</exception>
|
||||
// Token: 0x0600040D RID: 1037 RVA: 0x000136B4 File Offset: 0x000118B4
|
||||
public static int Sum(this IQueryable<int> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<int>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of nullable <see cref="T:System.Int32" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Int32" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int32.MaxValue" />.</exception>
|
||||
// Token: 0x0600040E RID: 1038 RVA: 0x000136F0 File Offset: 0x000118F0
|
||||
public static int? Sum(this IQueryable<int?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<int?>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of <see cref="T:System.Int64" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Int64" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x0600040F RID: 1039 RVA: 0x0001372C File Offset: 0x0001192C
|
||||
public static long Sum(this IQueryable<long> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<long>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of nullable <see cref="T:System.Int64" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Int64" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Int64.MaxValue" />.</exception>
|
||||
// Token: 0x06000410 RID: 1040 RVA: 0x00013768 File Offset: 0x00011968
|
||||
public static long? Sum(this IQueryable<long?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<long?>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of <see cref="T:System.Single" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Single" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x06000411 RID: 1041 RVA: 0x000137A4 File Offset: 0x000119A4
|
||||
public static float Sum(this IQueryable<float> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<float>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of nullable <see cref="T:System.Single" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Single" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x06000412 RID: 1042 RVA: 0x000137E0 File Offset: 0x000119E0
|
||||
public static float? Sum(this IQueryable<float?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<float?>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of <see cref="T:System.Double" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Double" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x06000413 RID: 1043 RVA: 0x0001381C File Offset: 0x00011A1C
|
||||
public static double Sum(this IQueryable<double> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<double>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of nullable <see cref="T:System.Double" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Double" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x06000414 RID: 1044 RVA: 0x00013858 File Offset: 0x00011A58
|
||||
public static double? Sum(this IQueryable<double?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<double?>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of <see cref="T:System.Decimal" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of <see cref="T:System.Decimal" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Decimal.MaxValue" />.</exception>
|
||||
// Token: 0x06000415 RID: 1045 RVA: 0x00013894 File Offset: 0x00011A94
|
||||
public static decimal Sum(this IQueryable<decimal> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<decimal>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Computes the sum of a sequence of nullable <see cref="T:System.Decimal" /> values.</summary>
|
||||
/// <returns>The sum of the values in the sequence.</returns>
|
||||
/// <param name="source">A sequence of nullable <see cref="T:System.Decimal" /> values to calculate the sum of.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
/// <exception cref="T:System.OverflowException">The sum is larger than <see cref="F:System.Decimal.MaxValue" />.</exception>
|
||||
// Token: 0x06000416 RID: 1046 RVA: 0x000138D0 File Offset: 0x00011AD0
|
||||
public static decimal? Sum(this IQueryable<decimal?> source)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.Execute<decimal?>(Queryable.StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), new Expression[] { source.Expression }));
|
||||
}
|
||||
|
||||
/// <summary>Returns a specified number of contiguous elements from the start of a sequence.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains the specified number of elements from the start of <paramref name="source" />.</returns>
|
||||
/// <param name="source">The sequence to return elements from.</param>
|
||||
/// <param name="count">The number of elements to return.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> is null.</exception>
|
||||
// Token: 0x06000417 RID: 1047 RVA: 0x0001390C File Offset: 0x00011B0C
|
||||
public static IQueryable<TSource> Take<TSource>(this IQueryable<TSource> source, int count)
|
||||
{
|
||||
Check.Source(source);
|
||||
return source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Constant(count)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Returns elements from a sequence as long as a specified condition is true.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains elements from the input sequence occurring before the element at which the test specified by <paramref name="predicate" /> no longer passes.</returns>
|
||||
/// <param name="source">The sequence to return elements from.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x06000418 RID: 1048 RVA: 0x0001396C File Offset: 0x00011B6C
|
||||
public static IQueryable<TSource> TakeWhile<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>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.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains elements from the input sequence occurring before the element at which the test specified by <paramref name="predicate" /> no longer passes.</returns>
|
||||
/// <param name="source">The sequence to return elements from.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition; the second parameter of the function represents the index of the element in the source sequence.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x06000419 RID: 1049 RVA: 0x000139C8 File Offset: 0x00011BC8
|
||||
public static IQueryable<TSource> TakeWhile<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedQueryable`1" /> whose elements are sorted according to a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IOrderedQueryable`1" /> that contains elements to sort.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function represented by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x0600041A RID: 1050 RVA: 0x00013A24 File Offset: 0x00011C24
|
||||
public static IOrderedQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return (IOrderedQueryable<TSource>)source.Provider.CreateQuery(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Performs a subsequent ordering of the elements in a sequence in ascending order by using a specified comparer.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedQueryable`1" /> whose elements are sorted according to a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IOrderedQueryable`1" /> that contains elements to sort.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function represented by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
|
||||
// Token: 0x0600041B RID: 1051 RVA: 0x00013A90 File Offset: 0x00011C90
|
||||
public static IOrderedQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return (IOrderedQueryable<TSource>)source.Provider.CreateQuery(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Performs a subsequent ordering of the elements in a sequence in descending order, according to a key.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IOrderedQueryable`1" /> whose elements are sorted in descending order according to a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IOrderedQueryable`1" /> that contains elements to sort.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key returned by the function represented by <paramref name="keySelector" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> is null.</exception>
|
||||
// Token: 0x0600041C RID: 1052 RVA: 0x00013B04 File Offset: 0x00011D04
|
||||
public static IOrderedQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return (IOrderedQueryable<TSource>)source.Provider.CreateQuery(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Performs a subsequent ordering of the elements in a sequence in descending order by using a specified comparer.</summary>
|
||||
/// <returns>A collection whose elements are sorted in descending order according to a key.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IOrderedQueryable`1" /> that contains elements to sort.</param>
|
||||
/// <param name="keySelector">A function to extract a key from each element.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IComparer`1" /> to compare keys.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the key that is returned by the <paramref name="keySelector" /> function.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="keySelector" /> or <paramref name="comparer" /> is null.</exception>
|
||||
// Token: 0x0600041D RID: 1053 RVA: 0x00013B70 File Offset: 0x00011D70
|
||||
public static IOrderedQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
|
||||
{
|
||||
Check.SourceAndKeySelector(source, keySelector);
|
||||
return (IOrderedQueryable<TSource>)source.Provider.CreateQuery(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[]
|
||||
{
|
||||
typeof(TSource),
|
||||
typeof(TKey)
|
||||
}), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(keySelector),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Produces the set union of two sequences by using the default equality comparer.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains the elements from both input sequences, excluding duplicates.</returns>
|
||||
/// <param name="source1">A sequence whose distinct elements form the first set for the union operation.</param>
|
||||
/// <param name="source2">A sequence whose distinct elements form the second set for the union operation.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source1" /> or <paramref name="source2" /> is null.</exception>
|
||||
// Token: 0x0600041E RID: 1054 RVA: 0x00013BE4 File Offset: 0x00011DE4
|
||||
public static IQueryable<TSource> Union<TSource>(this IQueryable<TSource> source1, IEnumerable<TSource> source2)
|
||||
{
|
||||
Check.Source1AndSource2(source1, source2);
|
||||
return source1.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source1.Expression,
|
||||
Expression.Constant(source2)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Produces the set union of two sequences by using a specified <see cref="T:System.Collections.Generic.IEqualityComparer`1" />.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains the elements from both input sequences, excluding duplicates.</returns>
|
||||
/// <param name="source1">A sequence whose distinct elements form the first set for the union operation.</param>
|
||||
/// <param name="source2">A sequence whose distinct elements form the second set for the union operation.</param>
|
||||
/// <param name="comparer">An <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to compare values.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source1" /> or <paramref name="source2" /> is null.</exception>
|
||||
// Token: 0x0600041F RID: 1055 RVA: 0x00013C40 File Offset: 0x00011E40
|
||||
public static IQueryable<TSource> Union<TSource>(this IQueryable<TSource> source1, IEnumerable<TSource> source2, IEqualityComparer<TSource> comparer)
|
||||
{
|
||||
Check.Source1AndSource2(source1, source2);
|
||||
return source1.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source1.Expression,
|
||||
Expression.Constant(source2),
|
||||
Expression.Constant(comparer)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Filters a sequence of values based on a predicate.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains elements from the input sequence that satisfy the condition specified by <paramref name="predicate" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to filter.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x06000420 RID: 1056 RVA: 0x00013CA4 File Offset: 0x00011EA4
|
||||
public static IQueryable<TSource> Where<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function.</summary>
|
||||
/// <returns>An <see cref="T:System.Linq.IQueryable`1" /> that contains elements from the input sequence that satisfy the condition specified by <paramref name="predicate" />.</returns>
|
||||
/// <param name="source">An <see cref="T:System.Linq.IQueryable`1" /> to filter.</param>
|
||||
/// <param name="predicate">A function to test each element for a condition; the second parameter of the function represents the index of the element in the source sequence.</param>
|
||||
/// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="source" /> or <paramref name="predicate" /> is null.</exception>
|
||||
// Token: 0x06000421 RID: 1057 RVA: 0x00013D00 File Offset: 0x00011F00
|
||||
public static IQueryable<TSource> Where<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
|
||||
{
|
||||
Check.SourceAndPredicate(source, predicate);
|
||||
return source.Provider.CreateQuery<TSource>(Queryable.StaticCall(Queryable.MakeGeneric(MethodBase.GetCurrentMethod(), new Type[] { typeof(TSource) }), new Expression[]
|
||||
{
|
||||
source.Expression,
|
||||
Expression.Quote(predicate)
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
// Token: 0x02000045 RID: 69
|
||||
internal class QueryableEnumerable<TElement> : IEnumerable, IOrderedQueryable, IQueryProvider, IQueryable, IQueryableEnumerable, IEnumerable<TElement>, IQueryableEnumerable<TElement>, IQueryable<TElement>, IOrderedQueryable<TElement>
|
||||
{
|
||||
// Token: 0x06000423 RID: 1059 RVA: 0x00013D5C File Offset: 0x00011F5C
|
||||
public QueryableEnumerable(IEnumerable<TElement> enumerable)
|
||||
{
|
||||
this.expression = Expression.Constant(this);
|
||||
this.enumerable = enumerable;
|
||||
}
|
||||
|
||||
// Token: 0x06000424 RID: 1060 RVA: 0x00013D78 File Offset: 0x00011F78
|
||||
public QueryableEnumerable(Expression expression)
|
||||
{
|
||||
this.expression = expression;
|
||||
}
|
||||
|
||||
// Token: 0x06000425 RID: 1061 RVA: 0x00013D88 File Offset: 0x00011F88
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return this.GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x17000043 RID: 67
|
||||
// (get) Token: 0x06000426 RID: 1062 RVA: 0x00013D90 File Offset: 0x00011F90
|
||||
public Type ElementType
|
||||
{
|
||||
get
|
||||
{
|
||||
return typeof(TElement);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000044 RID: 68
|
||||
// (get) Token: 0x06000427 RID: 1063 RVA: 0x00013D9C File Offset: 0x00011F9C
|
||||
public Expression Expression
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.expression;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000045 RID: 69
|
||||
// (get) Token: 0x06000428 RID: 1064 RVA: 0x00013DA4 File Offset: 0x00011FA4
|
||||
public IQueryProvider Provider
|
||||
{
|
||||
get
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000429 RID: 1065 RVA: 0x00013DA8 File Offset: 0x00011FA8
|
||||
public IEnumerable GetEnumerable()
|
||||
{
|
||||
return this.enumerable;
|
||||
}
|
||||
|
||||
// Token: 0x0600042A RID: 1066 RVA: 0x00013DB0 File Offset: 0x00011FB0
|
||||
public IEnumerator<TElement> GetEnumerator()
|
||||
{
|
||||
return this.Execute<IEnumerable<TElement>>(this.expression).GetEnumerator();
|
||||
}
|
||||
|
||||
// Token: 0x0600042B RID: 1067 RVA: 0x00013DC4 File Offset: 0x00011FC4
|
||||
public IQueryable CreateQuery(Expression expression)
|
||||
{
|
||||
return (IQueryable)Activator.CreateInstance(typeof(QueryableEnumerable<>).MakeGenericType(new Type[] { expression.Type.GetFirstGenericArgument() }), new object[] { expression });
|
||||
}
|
||||
|
||||
// Token: 0x0600042C RID: 1068 RVA: 0x00013E08 File Offset: 0x00012008
|
||||
public object Execute(Expression expression)
|
||||
{
|
||||
LambdaExpression lambdaExpression = Expression.Lambda(QueryableEnumerable<TElement>.TransformQueryable(expression), new ParameterExpression[0]);
|
||||
return lambdaExpression.Compile().DynamicInvoke(new object[0]);
|
||||
}
|
||||
|
||||
// Token: 0x0600042D RID: 1069 RVA: 0x00013E38 File Offset: 0x00012038
|
||||
private static Expression TransformQueryable(Expression expression)
|
||||
{
|
||||
return new QueryableTransformer().Transform(expression);
|
||||
}
|
||||
|
||||
// Token: 0x0600042E RID: 1070 RVA: 0x00013E48 File Offset: 0x00012048
|
||||
public IQueryable<TElem> CreateQuery<TElem>(Expression expression)
|
||||
{
|
||||
return new QueryableEnumerable<TElem>(expression);
|
||||
}
|
||||
|
||||
// Token: 0x0600042F RID: 1071 RVA: 0x00013E50 File Offset: 0x00012050
|
||||
public TResult Execute<TResult>(Expression expression)
|
||||
{
|
||||
Expression<Func<TResult>> expression2 = Expression.Lambda<Func<TResult>>(QueryableEnumerable<TElement>.TransformQueryable(expression), new ParameterExpression[0]);
|
||||
return expression2.Compile()();
|
||||
}
|
||||
|
||||
// Token: 0x040000F0 RID: 240
|
||||
private Expression expression;
|
||||
|
||||
// Token: 0x040000F1 RID: 241
|
||||
private IEnumerable<TElement> enumerable;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
// Token: 0x02000046 RID: 70
|
||||
internal class QueryableTransformer : ExpressionTransformer
|
||||
{
|
||||
// Token: 0x06000431 RID: 1073 RVA: 0x00013E84 File Offset: 0x00012084
|
||||
protected override Expression VisitMethodCall(MethodCallExpression methodCall)
|
||||
{
|
||||
if (QueryableTransformer.IsQueryableExtension(methodCall.Method))
|
||||
{
|
||||
return this.ReplaceQueryableMethod(methodCall);
|
||||
}
|
||||
return base.VisitMethodCall(methodCall);
|
||||
}
|
||||
|
||||
// Token: 0x06000432 RID: 1074 RVA: 0x00013EB0 File Offset: 0x000120B0
|
||||
protected override Expression VisitLambda(LambdaExpression lambda)
|
||||
{
|
||||
return lambda;
|
||||
}
|
||||
|
||||
// Token: 0x06000433 RID: 1075 RVA: 0x00013EB4 File Offset: 0x000120B4
|
||||
protected override Expression VisitConstant(ConstantExpression constant)
|
||||
{
|
||||
IQueryableEnumerable queryableEnumerable = constant.Value as IQueryableEnumerable;
|
||||
if (queryableEnumerable == null)
|
||||
{
|
||||
return constant;
|
||||
}
|
||||
return Expression.Constant(queryableEnumerable.GetEnumerable());
|
||||
}
|
||||
|
||||
// Token: 0x06000434 RID: 1076 RVA: 0x00013EE0 File Offset: 0x000120E0
|
||||
private static bool IsQueryableExtension(MethodInfo method)
|
||||
{
|
||||
return QueryableTransformer.HasExtensionAttribute(method) && method.GetParameters()[0].ParameterType.IsAssignableTo(typeof(IQueryable));
|
||||
}
|
||||
|
||||
// Token: 0x06000435 RID: 1077 RVA: 0x00013F18 File Offset: 0x00012118
|
||||
private static bool HasExtensionAttribute(MethodInfo method)
|
||||
{
|
||||
return method.GetCustomAttributes(typeof(ExtensionAttribute), false).Length > 0;
|
||||
}
|
||||
|
||||
// Token: 0x06000436 RID: 1078 RVA: 0x00013F30 File Offset: 0x00012130
|
||||
private MethodCallExpression ReplaceQueryableMethod(MethodCallExpression old)
|
||||
{
|
||||
Expression expression = null;
|
||||
if (old.Object != null)
|
||||
{
|
||||
expression = this.Visit(old.Object);
|
||||
}
|
||||
MethodInfo methodInfo = QueryableTransformer.ReplaceQueryableMethod(old.Method);
|
||||
ParameterInfo[] parameters = methodInfo.GetParameters();
|
||||
Expression[] array = new Expression[old.Arguments.Count];
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
array[i] = QueryableTransformer.UnquoteIfNeeded(this.Visit(old.Arguments[i]), parameters[i].ParameterType);
|
||||
}
|
||||
return new MethodCallExpression(expression, methodInfo, array.ToReadOnlyCollection<Expression>());
|
||||
}
|
||||
|
||||
// Token: 0x06000437 RID: 1079 RVA: 0x00013FC8 File Offset: 0x000121C8
|
||||
private static Expression UnquoteIfNeeded(Expression expression, Type delegateType)
|
||||
{
|
||||
if (expression.NodeType != ExpressionType.Quote)
|
||||
{
|
||||
return expression;
|
||||
}
|
||||
LambdaExpression lambdaExpression = (LambdaExpression)((UnaryExpression)expression).Operand;
|
||||
if (lambdaExpression.Type == delegateType)
|
||||
{
|
||||
return lambdaExpression;
|
||||
}
|
||||
return expression;
|
||||
}
|
||||
|
||||
// Token: 0x06000438 RID: 1080 RVA: 0x00014004 File Offset: 0x00012204
|
||||
private static Type GetTargetDeclaringType(MethodInfo method)
|
||||
{
|
||||
return (method.DeclaringType != typeof(Queryable)) ? method.DeclaringType : typeof(Enumerable);
|
||||
}
|
||||
|
||||
// Token: 0x06000439 RID: 1081 RVA: 0x0001403C File Offset: 0x0001223C
|
||||
private static MethodInfo ReplaceQueryableMethod(MethodInfo method)
|
||||
{
|
||||
MethodInfo matchingMethod = QueryableTransformer.GetMatchingMethod(method, QueryableTransformer.GetTargetDeclaringType(method));
|
||||
if (matchingMethod != null)
|
||||
{
|
||||
return matchingMethod;
|
||||
}
|
||||
throw new InvalidOperationException(string.Format("There is no method {0} on type {1} that matches the specified arguments", method.Name, method.DeclaringType.FullName));
|
||||
}
|
||||
|
||||
// Token: 0x0600043A RID: 1082 RVA: 0x00014080 File Offset: 0x00012280
|
||||
private static MethodInfo GetMatchingMethod(MethodInfo method, Type declaring)
|
||||
{
|
||||
MethodInfo[] methods = declaring.GetMethods();
|
||||
int i = 0;
|
||||
while (i < methods.Length)
|
||||
{
|
||||
MethodInfo methodInfo = methods[i];
|
||||
if (!QueryableTransformer.MethodMatch(methodInfo, method))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (method.IsGenericMethod)
|
||||
{
|
||||
return methodInfo.MakeGenericMethodFrom(method);
|
||||
}
|
||||
return methodInfo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x0600043B RID: 1083 RVA: 0x000140D4 File Offset: 0x000122D4
|
||||
private static bool MethodMatch(MethodInfo candidate, MethodInfo method)
|
||||
{
|
||||
if (candidate.Name != method.Name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!QueryableTransformer.HasExtensionAttribute(candidate))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Type[] parameterTypes = method.GetParameterTypes();
|
||||
if (parameterTypes.Length != candidate.GetParameters().Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (method.IsGenericMethod)
|
||||
{
|
||||
if (!candidate.IsGenericMethod)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (candidate.GetGenericArguments().Length != method.GetGenericArguments().Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
candidate = candidate.MakeGenericMethodFrom(method);
|
||||
}
|
||||
if (!QueryableTransformer.TypeMatch(candidate.ReturnType, method.ReturnType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Type[] parameterTypes2 = candidate.GetParameterTypes();
|
||||
if (parameterTypes2[0] != QueryableTransformer.GetComparableType(parameterTypes[0]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 1; i < parameterTypes2.Length; i++)
|
||||
{
|
||||
if (!QueryableTransformer.TypeMatch(parameterTypes2[i], parameterTypes[i]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x0600043C RID: 1084 RVA: 0x000141B0 File Offset: 0x000123B0
|
||||
private static bool TypeMatch(Type candidate, Type type)
|
||||
{
|
||||
return candidate == type || candidate == QueryableTransformer.GetComparableType(type);
|
||||
}
|
||||
|
||||
// Token: 0x0600043D RID: 1085 RVA: 0x000141C4 File Offset: 0x000123C4
|
||||
private static Type GetComparableType(Type type)
|
||||
{
|
||||
if (type.IsGenericInstanceOf(typeof(IQueryable<>)))
|
||||
{
|
||||
type = typeof(IEnumerable<>).MakeGenericTypeFrom(type);
|
||||
}
|
||||
else if (type.IsGenericInstanceOf(typeof(IOrderedQueryable<>)))
|
||||
{
|
||||
type = typeof(IOrderedEnumerable<>).MakeGenericTypeFrom(type);
|
||||
}
|
||||
else if (type.IsGenericInstanceOf(typeof(Expression<>)))
|
||||
{
|
||||
type = type.GetFirstGenericArgument();
|
||||
}
|
||||
else if (type == typeof(IQueryable))
|
||||
{
|
||||
type = typeof(IEnumerable);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
// Token: 0x02000047 RID: 71
|
||||
internal class QuickSort<TElement>
|
||||
{
|
||||
// Token: 0x0600043E RID: 1086 RVA: 0x00014268 File Offset: 0x00012468
|
||||
private QuickSort(IEnumerable<TElement> source, SortContext<TElement> context)
|
||||
{
|
||||
this.elements = source.ToArray<TElement>();
|
||||
this.indexes = QuickSort<TElement>.CreateIndexes(this.elements.Length);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
// Token: 0x0600043F RID: 1087 RVA: 0x000142A4 File Offset: 0x000124A4
|
||||
private static int[] CreateIndexes(int length)
|
||||
{
|
||||
int[] array = new int[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
array[i] = i;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x06000440 RID: 1088 RVA: 0x000142D0 File Offset: 0x000124D0
|
||||
private void PerformSort()
|
||||
{
|
||||
if (this.elements.Length <= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.context.Initialize(this.elements);
|
||||
this.Sort(0, this.indexes.Length - 1);
|
||||
}
|
||||
|
||||
// Token: 0x06000441 RID: 1089 RVA: 0x00014304 File Offset: 0x00012504
|
||||
private int CompareItems(int first_index, int second_index)
|
||||
{
|
||||
return this.context.Compare(first_index, second_index);
|
||||
}
|
||||
|
||||
// Token: 0x06000442 RID: 1090 RVA: 0x00014314 File Offset: 0x00012514
|
||||
private int MedianOfThree(int left, int right)
|
||||
{
|
||||
int num = (left + right) / 2;
|
||||
if (this.CompareItems(this.indexes[num], this.indexes[left]) < 0)
|
||||
{
|
||||
this.Swap(left, num);
|
||||
}
|
||||
if (this.CompareItems(this.indexes[right], this.indexes[left]) < 0)
|
||||
{
|
||||
this.Swap(left, right);
|
||||
}
|
||||
if (this.CompareItems(this.indexes[right], this.indexes[num]) < 0)
|
||||
{
|
||||
this.Swap(num, right);
|
||||
}
|
||||
this.Swap(num, right - 1);
|
||||
return this.indexes[right - 1];
|
||||
}
|
||||
|
||||
// Token: 0x06000443 RID: 1091 RVA: 0x000143A8 File Offset: 0x000125A8
|
||||
private void Sort(int left, int right)
|
||||
{
|
||||
if (left + 3 <= right)
|
||||
{
|
||||
int num = left;
|
||||
int num2 = right - 1;
|
||||
int num3 = this.MedianOfThree(left, right);
|
||||
for (;;)
|
||||
{
|
||||
while (this.CompareItems(this.indexes[++num], num3) < 0)
|
||||
{
|
||||
}
|
||||
while (this.CompareItems(this.indexes[--num2], num3) > 0)
|
||||
{
|
||||
}
|
||||
if (num >= num2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
this.Swap(num, num2);
|
||||
}
|
||||
this.Swap(num, right - 1);
|
||||
this.Sort(left, num - 1);
|
||||
this.Sort(num + 1, right);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.InsertionSort(left, right);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000444 RID: 1092 RVA: 0x00014454 File Offset: 0x00012654
|
||||
private void InsertionSort(int left, int right)
|
||||
{
|
||||
for (int i = left + 1; i <= right; i++)
|
||||
{
|
||||
int num = this.indexes[i];
|
||||
int num2 = i;
|
||||
while (num2 > left && this.CompareItems(num, this.indexes[num2 - 1]) < 0)
|
||||
{
|
||||
this.indexes[num2] = this.indexes[num2 - 1];
|
||||
num2--;
|
||||
}
|
||||
this.indexes[num2] = num;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000445 RID: 1093 RVA: 0x000144C4 File Offset: 0x000126C4
|
||||
private void Swap(int left, int right)
|
||||
{
|
||||
int num = this.indexes[right];
|
||||
this.indexes[right] = this.indexes[left];
|
||||
this.indexes[left] = num;
|
||||
}
|
||||
|
||||
// Token: 0x06000446 RID: 1094 RVA: 0x000144F4 File Offset: 0x000126F4
|
||||
public static IEnumerable<TElement> Sort(IEnumerable<TElement> source, SortContext<TElement> context)
|
||||
{
|
||||
QuickSort<TElement> sorter = new QuickSort<TElement>(source, context);
|
||||
sorter.PerformSort();
|
||||
for (int i = 0; i < sorter.indexes.Length; i++)
|
||||
{
|
||||
yield return sorter.elements[sorter.indexes[i]];
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
// Token: 0x040000F2 RID: 242
|
||||
private TElement[] elements;
|
||||
|
||||
// Token: 0x040000F3 RID: 243
|
||||
private int[] indexes;
|
||||
|
||||
// Token: 0x040000F4 RID: 244
|
||||
private SortContext<TElement> context;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
// Token: 0x02000048 RID: 72
|
||||
internal abstract class SortContext<TElement>
|
||||
{
|
||||
// Token: 0x06000447 RID: 1095 RVA: 0x0001452C File Offset: 0x0001272C
|
||||
protected SortContext(SortDirection direction, SortContext<TElement> child_context)
|
||||
{
|
||||
this.direction = direction;
|
||||
this.child_context = child_context;
|
||||
}
|
||||
|
||||
// Token: 0x06000448 RID: 1096
|
||||
public abstract void Initialize(TElement[] elements);
|
||||
|
||||
// Token: 0x06000449 RID: 1097
|
||||
public abstract int Compare(int first_index, int second_index);
|
||||
|
||||
// Token: 0x040000F5 RID: 245
|
||||
protected SortDirection direction;
|
||||
|
||||
// Token: 0x040000F6 RID: 246
|
||||
protected SortContext<TElement> child_context;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
// Token: 0x02000049 RID: 73
|
||||
internal enum SortDirection
|
||||
{
|
||||
// Token: 0x040000F8 RID: 248
|
||||
Ascending,
|
||||
// Token: 0x040000F9 RID: 249
|
||||
Descending
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.Linq
|
||||
{
|
||||
// Token: 0x0200004A RID: 74
|
||||
internal class SortSequenceContext<TElement, TKey> : SortContext<TElement>
|
||||
{
|
||||
// Token: 0x0600044A RID: 1098 RVA: 0x00014544 File Offset: 0x00012744
|
||||
public SortSequenceContext(Func<TElement, TKey> selector, IComparer<TKey> comparer, SortDirection direction, SortContext<TElement> child_context)
|
||||
: base(direction, child_context)
|
||||
{
|
||||
this.selector = selector;
|
||||
this.comparer = comparer;
|
||||
}
|
||||
|
||||
// Token: 0x0600044B RID: 1099 RVA: 0x00014560 File Offset: 0x00012760
|
||||
public override void Initialize(TElement[] elements)
|
||||
{
|
||||
if (this.child_context != null)
|
||||
{
|
||||
this.child_context.Initialize(elements);
|
||||
}
|
||||
this.keys = new TKey[elements.Length];
|
||||
for (int i = 0; i < this.keys.Length; i++)
|
||||
{
|
||||
this.keys[i] = this.selector(elements[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600044C RID: 1100 RVA: 0x000145CC File Offset: 0x000127CC
|
||||
public override int Compare(int first_index, int second_index)
|
||||
{
|
||||
int num = this.comparer.Compare(this.keys[first_index], this.keys[second_index]);
|
||||
if (num == 0)
|
||||
{
|
||||
if (this.child_context != null)
|
||||
{
|
||||
return this.child_context.Compare(first_index, second_index);
|
||||
}
|
||||
num = ((this.direction != SortDirection.Descending) ? (first_index - second_index) : (second_index - first_index));
|
||||
}
|
||||
return (this.direction != SortDirection.Descending) ? num : (-num);
|
||||
}
|
||||
|
||||
// Token: 0x040000FA RID: 250
|
||||
private Func<TElement, TKey> selector;
|
||||
|
||||
// Token: 0x040000FB RID: 251
|
||||
private IComparer<TKey> comparer;
|
||||
|
||||
// Token: 0x040000FC RID: 252
|
||||
private TKey[] keys;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user