diff --git a/src/libraries/Common/tests/System/Linq/SkipTakeData.cs b/src/libraries/Common/tests/System/Linq/SkipTakeData.cs index b5e6386786a7d..6d134c9c33e48 100644 --- a/src/libraries/Common/tests/System/Linq/SkipTakeData.cs +++ b/src/libraries/Common/tests/System/Linq/SkipTakeData.cs @@ -30,7 +30,7 @@ public static IEnumerable QueryableData() return EnumerableData().Select(array => { var enumerable = (IEnumerable)array[0]; - return new object[] { enumerable.AsQueryable(), array[1] }; + return new[] { enumerable.AsQueryable(), array[1] }; }); } } diff --git a/src/libraries/System.Linq.Queryable/src/System.Linq.Queryable.csproj b/src/libraries/System.Linq.Queryable/src/System.Linq.Queryable.csproj index 75fb21c085ac1..5906a0a749f3d 100644 --- a/src/libraries/System.Linq.Queryable/src/System.Linq.Queryable.csproj +++ b/src/libraries/System.Linq.Queryable/src/System.Linq.Queryable.csproj @@ -4,7 +4,6 @@ true - diff --git a/src/libraries/System.Linq.Queryable/src/System/Linq/CachedReflection.cs b/src/libraries/System.Linq.Queryable/src/System/Linq/CachedReflection.cs deleted file mode 100644 index 514580fb334c0..0000000000000 --- a/src/libraries/System.Linq.Queryable/src/System/Linq/CachedReflection.cs +++ /dev/null @@ -1,1061 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using System.Reflection; - -namespace System.Linq -{ - [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2060:MakeGenericMethod", - Justification = "The methods passed into MakeGenericMethod do not contain trim annotations.")] - internal static class CachedReflectionInfo - { - private static MethodInfo? s_Aggregate_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Aggregate_TSource_2(Type TSource) => - (s_Aggregate_TSource_2 ??= new Func, Expression>, object>(Queryable.Aggregate).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Aggregate_TSource_TAccumulate_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Aggregate_TSource_TAccumulate_3(Type TSource, Type TAccumulate) => - (s_Aggregate_TSource_TAccumulate_3 ??= new Func, object, Expression>, object>(Queryable.Aggregate).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TAccumulate); - - private static MethodInfo? s_Aggregate_TSource_TAccumulate_TResult_4; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Aggregate_TSource_TAccumulate_TResult_4(Type TSource, Type TAccumulate, Type TResult) => - (s_Aggregate_TSource_TAccumulate_TResult_4 ??= new Func, object, Expression>, Expression>, object>(Queryable.Aggregate).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TAccumulate, TResult); - - private static MethodInfo? s_All_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo All_TSource_2(Type TSource) => - (s_All_TSource_2 ??= new Func, Expression>, bool>(Queryable.All).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Any_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Any_TSource_1(Type TSource) => - (s_Any_TSource_1 ??= new Func, bool>(Queryable.Any).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Any_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Any_TSource_2(Type TSource) => - (s_Any_TSource_2 ??= new Func, Expression>, bool>(Queryable.Any).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Average_Int32_1; - - public static MethodInfo Average_Int32_1 => - s_Average_Int32_1 ??= new Func, double>(Queryable.Average).GetMethodInfo(); - - private static MethodInfo? s_Average_NullableInt32_1; - - public static MethodInfo Average_NullableInt32_1 => - s_Average_NullableInt32_1 ??= new Func, double?>(Queryable.Average).GetMethodInfo(); - - private static MethodInfo? s_Average_Int64_1; - - public static MethodInfo Average_Int64_1 => - s_Average_Int64_1 ??= new Func, double>(Queryable.Average).GetMethodInfo(); - - private static MethodInfo? s_Average_NullableInt64_1; - - public static MethodInfo Average_NullableInt64_1 => - s_Average_NullableInt64_1 ??= new Func, double?>(Queryable.Average).GetMethodInfo(); - - private static MethodInfo? s_Average_Single_1; - - public static MethodInfo Average_Single_1 => - s_Average_Single_1 ??= new Func, float>(Queryable.Average).GetMethodInfo(); - - private static MethodInfo? s_Average_NullableSingle_1; - - public static MethodInfo Average_NullableSingle_1 => - s_Average_NullableSingle_1 ??= new Func, float?>(Queryable.Average).GetMethodInfo(); - - private static MethodInfo? s_Average_Double_1; - - public static MethodInfo Average_Double_1 => - s_Average_Double_1 ??= new Func, double>(Queryable.Average).GetMethodInfo(); - - private static MethodInfo? s_Average_NullableDouble_1; - - public static MethodInfo Average_NullableDouble_1 => - s_Average_NullableDouble_1 ??= new Func, double?>(Queryable.Average).GetMethodInfo(); - - private static MethodInfo? s_Average_Decimal_1; - - public static MethodInfo Average_Decimal_1 => - s_Average_Decimal_1 ??= new Func, decimal>(Queryable.Average).GetMethodInfo(); - - private static MethodInfo? s_Average_NullableDecimal_1; - - public static MethodInfo Average_NullableDecimal_1 => - s_Average_NullableDecimal_1 ??= new Func, decimal?>(Queryable.Average).GetMethodInfo(); - - private static MethodInfo? s_Average_Int32_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Average_Int32_TSource_2(Type TSource) => - (s_Average_Int32_TSource_2 ??= new Func, Expression>, double>(Queryable.Average).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Average_NullableInt32_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Average_NullableInt32_TSource_2(Type TSource) => - (s_Average_NullableInt32_TSource_2 ??= new Func, Expression>, double?>(Queryable.Average).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Average_Single_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Average_Single_TSource_2(Type TSource) => - (s_Average_Single_TSource_2 ??= new Func, Expression>, float>(Queryable.Average).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Average_NullableSingle_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Average_NullableSingle_TSource_2(Type TSource) => - (s_Average_NullableSingle_TSource_2 ??= new Func, Expression>, float?>(Queryable.Average).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Average_Int64_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Average_Int64_TSource_2(Type TSource) => - (s_Average_Int64_TSource_2 ??= new Func, Expression>, double>(Queryable.Average).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Average_NullableInt64_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Average_NullableInt64_TSource_2(Type TSource) => - (s_Average_NullableInt64_TSource_2 ??= new Func, Expression>, double?>(Queryable.Average).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Average_Double_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Average_Double_TSource_2(Type TSource) => - (s_Average_Double_TSource_2 ??= new Func, Expression>, double>(Queryable.Average).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Average_NullableDouble_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Average_NullableDouble_TSource_2(Type TSource) => - (s_Average_NullableDouble_TSource_2 ??= new Func, Expression>, double?>(Queryable.Average).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Average_Decimal_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Average_Decimal_TSource_2(Type TSource) => - (s_Average_Decimal_TSource_2 ??= new Func, Expression>, decimal>(Queryable.Average).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Average_NullableDecimal_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Average_NullableDecimal_TSource_2(Type TSource) => - (s_Average_NullableDecimal_TSource_2 ??= new Func, Expression>, decimal?>(Queryable.Average).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Cast_TResult_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Cast_TResult_1(Type TResult) => - (s_Cast_TResult_1 ??= new Func>(Queryable.Cast).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TResult); - - private static MethodInfo? s_Chunk_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Chunk_TSource_1(Type TSource) => - (s_Chunk_TSource_1 ??= new Func, int, IQueryable>(Queryable.Chunk).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Concat_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Concat_TSource_2(Type TSource) => - (s_Concat_TSource_2 ??= new Func, IEnumerable, IQueryable>(Queryable.Concat).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Contains_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Contains_TSource_2(Type TSource) => - (s_Contains_TSource_2 ??= new Func, object, bool>(Queryable.Contains).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Contains_TSource_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Contains_TSource_3(Type TSource) => - (s_Contains_TSource_3 ??= new Func, object, IEqualityComparer, bool>(Queryable.Contains).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Count_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Count_TSource_1(Type TSource) => - (s_Count_TSource_1 ??= new Func, int>(Queryable.Count).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Count_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Count_TSource_2(Type TSource) => - (s_Count_TSource_2 ??= new Func, Expression>, int>(Queryable.Count).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_DefaultIfEmpty_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo DefaultIfEmpty_TSource_1(Type TSource) => - (s_DefaultIfEmpty_TSource_1 ??= new Func, IQueryable>(Queryable.DefaultIfEmpty).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_DefaultIfEmpty_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo DefaultIfEmpty_TSource_2(Type TSource) => - (s_DefaultIfEmpty_TSource_2 ??= new Func, object, IQueryable>(Queryable.DefaultIfEmpty).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Distinct_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Distinct_TSource_1(Type TSource) => - (s_Distinct_TSource_1 ??= new Func, IQueryable>(Queryable.Distinct).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Distinct_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Distinct_TSource_2(Type TSource) => - (s_Distinct_TSource_2 ??= new Func, IEqualityComparer, IQueryable>(Queryable.Distinct).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_DistinctBy_TSource_TKey_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo DistinctBy_TSource_TKey_2(Type TSource, Type TKey) => - (s_DistinctBy_TSource_TKey_2 ??= new Func, Expression>, IQueryable>(Queryable.DistinctBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_DistinctBy_TSource_TKey_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo DistinctBy_TSource_TKey_3(Type TSource, Type TKey) => - (s_DistinctBy_TSource_TKey_3 ??= new Func, Expression>, IEqualityComparer, IQueryable>(Queryable.DistinctBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_ElementAt_Int32_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo ElementAt_Int32_TSource_2(Type TSource) => - (s_ElementAt_Int32_TSource_2 ??= new Func, int, object>(Queryable.ElementAt).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_ElementAt_Index_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo ElementAt_Index_TSource_2(Type TSource) => - (s_ElementAt_Index_TSource_2 ??= new Func, Index, object>(Queryable.ElementAt).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_ElementAtOrDefault_Int32_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo ElementAtOrDefault_Int32_TSource_2(Type TSource) => - (s_ElementAtOrDefault_Int32_TSource_2 ??= new Func, int, object?>(Queryable.ElementAtOrDefault).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_ElementAtOrDefault_Index_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo ElementAtOrDefault_Index_TSource_2(Type TSource) => - (s_ElementAtOrDefault_Index_TSource_2 ??= new Func, Index, object?>(Queryable.ElementAtOrDefault).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Except_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Except_TSource_2(Type TSource) => - (s_Except_TSource_2 ??= new Func, IEnumerable, IQueryable>(Queryable.Except).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Except_TSource_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Except_TSource_3(Type TSource) => - (s_Except_TSource_3 ??= new Func, IEnumerable, IEqualityComparer, IQueryable>(Queryable.Except).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_ExceptBy_TSource_TKey_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo ExceptBy_TSource_TKey_3(Type TSource, Type TKey) => - (s_ExceptBy_TSource_TKey_3 ??= new Func, IEnumerable, Expression>, IQueryable>(Queryable.ExceptBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_ExceptBy_TSource_TKey_4; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo ExceptBy_TSource_TKey_4(Type TSource, Type TKey) => - (s_ExceptBy_TSource_TKey_4 ??= new Func, IEnumerable, Expression>, IEqualityComparer, IQueryable>(Queryable.ExceptBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_First_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo First_TSource_1(Type TSource) => - (s_First_TSource_1 ??= new Func, object>(Queryable.First).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_First_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo First_TSource_2(Type TSource) => - (s_First_TSource_2 ??= new Func, Expression>, object>(Queryable.First).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_FirstOrDefault_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo FirstOrDefault_TSource_1(Type TSource) => - (s_FirstOrDefault_TSource_1 ??= new Func, object?>(Queryable.FirstOrDefault).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_FirstOrDefault_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo FirstOrDefault_TSource_2(Type TSource) => - (s_FirstOrDefault_TSource_2 ??= new Func, Expression>, object?>(Queryable.FirstOrDefault).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_FirstOrDefault_TSource_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo FirstOrDefault_TSource_3(Type TSource) => - (s_FirstOrDefault_TSource_3 ??= new Func, object, object>(Queryable.FirstOrDefault).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_FirstOrDefault_TSource_4; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo FirstOrDefault_TSource_4(Type TSource) => - (s_FirstOrDefault_TSource_4 ??= new Func, Expression>, object, object>(Queryable.FirstOrDefault).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_GroupBy_TSource_TKey_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo GroupBy_TSource_TKey_2(Type TSource, Type TKey) => - (s_GroupBy_TSource_TKey_2 ??= new Func, Expression>, IQueryable>>(Queryable.GroupBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_GroupBy_TSource_TKey_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo GroupBy_TSource_TKey_3(Type TSource, Type TKey) => - (s_GroupBy_TSource_TKey_3 ??= new Func, Expression>, IEqualityComparer, IQueryable>>(Queryable.GroupBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_GroupBy_TSource_TKey_TElement_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo GroupBy_TSource_TKey_TElement_3(Type TSource, Type TKey, Type TElement) => - (s_GroupBy_TSource_TKey_TElement_3 ??= new Func, Expression>, Expression>, IQueryable>>(Queryable.GroupBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey, TElement); - - private static MethodInfo? s_GroupBy_TSource_TKey_TElement_4; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo GroupBy_TSource_TKey_TElement_4(Type TSource, Type TKey, Type TElement) => - (s_GroupBy_TSource_TKey_TElement_4 ??= new Func, Expression>, Expression>, IEqualityComparer, IQueryable>>(Queryable.GroupBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey, TElement); - - private static MethodInfo? s_GroupBy_TSource_TKey_TResult_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo GroupBy_TSource_TKey_TResult_3(Type TSource, Type TKey, Type TResult) => - (s_GroupBy_TSource_TKey_TResult_3 ??= new Func, Expression>, Expression, object>>, IQueryable>(Queryable.GroupBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey, TResult); - - private static MethodInfo? s_GroupBy_TSource_TKey_TResult_4; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo GroupBy_TSource_TKey_TResult_4(Type TSource, Type TKey, Type TResult) => - (s_GroupBy_TSource_TKey_TResult_4 ??= new Func, Expression>, Expression, object>>, IEqualityComparer, IQueryable>(Queryable.GroupBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey, TResult); - - private static MethodInfo? s_GroupBy_TSource_TKey_TElement_TResult_4; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo GroupBy_TSource_TKey_TElement_TResult_4(Type TSource, Type TKey, Type TElement, Type TResult) => - (s_GroupBy_TSource_TKey_TElement_TResult_4 ??= new Func, Expression>, Expression>, Expression, object>>, IQueryable>(Queryable.GroupBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey, TElement, TResult); - - private static MethodInfo? s_GroupBy_TSource_TKey_TElement_TResult_5; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo GroupBy_TSource_TKey_TElement_TResult_5(Type TSource, Type TKey, Type TElement, Type TResult) => - (s_GroupBy_TSource_TKey_TElement_TResult_5 ??= new Func, Expression>, Expression>, Expression, object>>, IEqualityComparer, IQueryable>(Queryable.GroupBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey, TElement, TResult); - - private static MethodInfo? s_GroupJoin_TOuter_TInner_TKey_TResult_5; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo GroupJoin_TOuter_TInner_TKey_TResult_5(Type TOuter, Type TInner, Type TKey, Type TResult) => - (s_GroupJoin_TOuter_TInner_TKey_TResult_5 ??= new Func, IEnumerable, Expression>, Expression>, Expression, object>>, IQueryable>(Queryable.GroupJoin).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TOuter, TInner, TKey, TResult); - - private static MethodInfo? s_GroupJoin_TOuter_TInner_TKey_TResult_6; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo GroupJoin_TOuter_TInner_TKey_TResult_6(Type TOuter, Type TInner, Type TKey, Type TResult) => - (s_GroupJoin_TOuter_TInner_TKey_TResult_6 ??= new Func, IEnumerable, Expression>, Expression>, Expression, object>>, IEqualityComparer, IQueryable>(Queryable.GroupJoin).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TOuter, TInner, TKey, TResult); - - private static MethodInfo? s_Intersect_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Intersect_TSource_2(Type TSource) => - (s_Intersect_TSource_2 ??= new Func, IEnumerable, IQueryable>(Queryable.Intersect).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Intersect_TSource_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Intersect_TSource_3(Type TSource) => - (s_Intersect_TSource_3 ??= new Func, IEnumerable, IEqualityComparer, IQueryable>(Queryable.Intersect).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_IntersectBy_TSource_TKey_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo IntersectBy_TSource_TKey_3(Type TSource, Type TKey) => - (s_IntersectBy_TSource_TKey_3 ??= new Func, IEnumerable, Expression>, IQueryable>(Queryable.IntersectBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_IntersectBy_TSource_TKey_4; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo IntersectBy_TSource_TKey_4(Type TSource, Type TKey) => - (s_IntersectBy_TSource_TKey_4 ??= new Func, IEnumerable, Expression>, IEqualityComparer, IQueryable>(Queryable.IntersectBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_Join_TOuter_TInner_TKey_TResult_5; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Join_TOuter_TInner_TKey_TResult_5(Type TOuter, Type TInner, Type TKey, Type TResult) => - (s_Join_TOuter_TInner_TKey_TResult_5 ??= new Func, IEnumerable, Expression>, Expression>, Expression>, IQueryable>(Queryable.Join).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TOuter, TInner, TKey, TResult); - - private static MethodInfo? s_Join_TOuter_TInner_TKey_TResult_6; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Join_TOuter_TInner_TKey_TResult_6(Type TOuter, Type TInner, Type TKey, Type TResult) => - (s_Join_TOuter_TInner_TKey_TResult_6 ??= new Func, IEnumerable, Expression>, Expression>, Expression>, IEqualityComparer, IQueryable>(Queryable.Join).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TOuter, TInner, TKey, TResult); - - private static MethodInfo? s_Last_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Last_TSource_1(Type TSource) => - (s_Last_TSource_1 ??= new Func, object>(Queryable.Last).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Last_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Last_TSource_2(Type TSource) => - (s_Last_TSource_2 ??= new Func, Expression>, object>(Queryable.Last).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_LastOrDefault_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo LastOrDefault_TSource_1(Type TSource) => - (s_LastOrDefault_TSource_1 ??= new Func, object?>(Queryable.LastOrDefault).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_LastOrDefault_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo LastOrDefault_TSource_2(Type TSource) => - (s_LastOrDefault_TSource_2 ??= new Func, Expression>, object?>(Queryable.LastOrDefault).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_LastOrDefault_TSource_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo LastOrDefault_TSource_3(Type TSource) => - (s_LastOrDefault_TSource_3 ??= new Func, object, object>(Queryable.LastOrDefault).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_LastOrDefault_TSource_4; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo LastOrDefault_TSource_4(Type TSource) => - (s_LastOrDefault_TSource_4 ??= new Func, Expression>, object, object>(Queryable.LastOrDefault).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_LongCount_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo LongCount_TSource_1(Type TSource) => - (s_LongCount_TSource_1 ??= new Func, long>(Queryable.LongCount).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_LongCount_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo LongCount_TSource_2(Type TSource) => - (s_LongCount_TSource_2 ??= new Func, Expression>, long>(Queryable.LongCount).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Max_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Max_TSource_1(Type TSource) => - (s_Max_TSource_1 ??= new Func, object?>(Queryable.Max).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Max_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Max_TSource_2(Type TSource) => - (s_Max_TSource_2 ??= new Func, IComparer, object?>(Queryable.Max).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Max_TSource_TResult_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Max_TSource_TResult_2(Type TSource, Type TResult) => - (s_Max_TSource_TResult_2 ??= new Func, Expression>, object?>(Queryable.Max).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TResult); - - private static MethodInfo? s_MaxBy_TSource_TKey_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo MaxBy_TSource_TKey_2(Type TSource, Type TKey) => - (s_MaxBy_TSource_TKey_2 ??= new Func, Expression>, object?>(Queryable.MaxBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_MaxBy_TSource_TKey_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo MaxBy_TSource_TKey_3(Type TSource, Type TKey) => - (s_MaxBy_TSource_TKey_3 ??= new Func, Expression>, IComparer, object?>(Queryable.MaxBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_Min_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Min_TSource_1(Type TSource) => - (s_Min_TSource_1 ??= new Func, object?>(Queryable.Min).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Min_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Min_TSource_2(Type TSource) => - (s_Min_TSource_2 ??= new Func, IComparer, object?>(Queryable.Min).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Min_TSource_TResult_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Min_TSource_TResult_2(Type TSource, Type TResult) => - (s_Min_TSource_TResult_2 ??= new Func, Expression>, object?>(Queryable.Min).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TResult); - - private static MethodInfo? s_MinBy_TSource_TKey_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo MinBy_TSource_TKey_2(Type TSource, Type TKey) => - (s_MinBy_TSource_TKey_2 ??= new Func, Expression>, object?>(Queryable.MinBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_MinBy_TSource_TKey_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo MinBy_TSource_TKey_3(Type TSource, Type TKey) => - (s_MinBy_TSource_TKey_3 ??= new Func, Expression>, IComparer, object?>(Queryable.MinBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_OfType_TResult_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo OfType_TResult_1(Type TResult) => - (s_OfType_TResult_1 ??= new Func>(Queryable.OfType).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TResult); - - private static MethodInfo? s_Order_T_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Order_T_1(Type T) => - (s_Order_T_1 ??= new Func, IOrderedQueryable>(Queryable.Order).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(T); - - private static MethodInfo? s_Order_T_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Order_T_2(Type T) => - (s_Order_T_2 ??= new Func, IComparer, IOrderedQueryable>(Queryable.Order).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(T); - - private static MethodInfo? s_OrderBy_TSource_TKey_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo OrderBy_TSource_TKey_2(Type TSource, Type TKey) => - (s_OrderBy_TSource_TKey_2 ??= new Func, Expression>, IOrderedQueryable>(Queryable.OrderBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_OrderDescending_T_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo OrderDescending_T_1(Type T) => - (s_OrderDescending_T_1 ??= new Func, IOrderedQueryable>(Queryable.OrderDescending).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(T); - - private static MethodInfo? s_OrderDescending_T_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo OrderDescending_T_2(Type T) => - (s_OrderDescending_T_2 ??= new Func, IComparer, IOrderedQueryable>(Queryable.OrderDescending).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(T); - - private static MethodInfo? s_OrderBy_TSource_TKey_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo OrderBy_TSource_TKey_3(Type TSource, Type TKey) => - (s_OrderBy_TSource_TKey_3 ??= new Func, Expression>, IComparer, IOrderedQueryable>(Queryable.OrderBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_OrderByDescending_TSource_TKey_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo OrderByDescending_TSource_TKey_2(Type TSource, Type TKey) => - (s_OrderByDescending_TSource_TKey_2 ??= new Func, Expression>, IOrderedQueryable>(Queryable.OrderByDescending).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_OrderByDescending_TSource_TKey_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo OrderByDescending_TSource_TKey_3(Type TSource, Type TKey) => - (s_OrderByDescending_TSource_TKey_3 ??= new Func, Expression>, IComparer, IOrderedQueryable>(Queryable.OrderByDescending).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_Reverse_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Reverse_TSource_1(Type TSource) => - (s_Reverse_TSource_1 ??= new Func, IQueryable>(Queryable.Reverse).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Select_TSource_TResult_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Select_TSource_TResult_2(Type TSource, Type TResult) => - (s_Select_TSource_TResult_2 ??= new Func, Expression>, IQueryable>(Queryable.Select).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TResult); - - private static MethodInfo? s_Select_Index_TSource_TResult_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Select_Index_TSource_TResult_2(Type TSource, Type TResult) => - (s_Select_Index_TSource_TResult_2 ??= new Func, Expression>, IQueryable>(Queryable.Select).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TResult); - - private static MethodInfo? s_SelectMany_TSource_TResult_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo SelectMany_TSource_TResult_2(Type TSource, Type TResult) => - (s_SelectMany_TSource_TResult_2 ??= new Func, Expression>>, IQueryable>(Queryable.SelectMany).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TResult); - - private static MethodInfo? s_SelectMany_Index_TSource_TResult_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo SelectMany_Index_TSource_TResult_2(Type TSource, Type TResult) => - (s_SelectMany_Index_TSource_TResult_2 ??= new Func, Expression>>, IQueryable>(Queryable.SelectMany).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TResult); - - private static MethodInfo? s_SelectMany_Index_TSource_TCollection_TResult_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo SelectMany_Index_TSource_TCollection_TResult_3(Type TSource, Type TCollection, Type TResult) => - (s_SelectMany_Index_TSource_TCollection_TResult_3 ??= new Func, Expression>>, Expression>, IQueryable>(Queryable.SelectMany).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TCollection, TResult); - - private static MethodInfo? s_SelectMany_TSource_TCollection_TResult_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo SelectMany_TSource_TCollection_TResult_3(Type TSource, Type TCollection, Type TResult) => - (s_SelectMany_TSource_TCollection_TResult_3 ??= new Func, Expression>>, Expression>, IQueryable>(Queryable.SelectMany).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TCollection, TResult); - - private static MethodInfo? s_SequenceEqual_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo SequenceEqual_TSource_2(Type TSource) => - (s_SequenceEqual_TSource_2 ??= new Func, IEnumerable, bool>(Queryable.SequenceEqual).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_SequenceEqual_TSource_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo SequenceEqual_TSource_3(Type TSource) => - (s_SequenceEqual_TSource_3 ??= new Func, IEnumerable, IEqualityComparer, bool>(Queryable.SequenceEqual).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Single_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Single_TSource_1(Type TSource) => - (s_Single_TSource_1 ??= new Func, object>(Queryable.Single).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Single_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Single_TSource_2(Type TSource) => - (s_Single_TSource_2 ??= new Func, Expression>, object>(Queryable.Single).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_SingleOrDefault_TSource_1; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo SingleOrDefault_TSource_1(Type TSource) => - (s_SingleOrDefault_TSource_1 ??= new Func, object?>(Queryable.SingleOrDefault).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_SingleOrDefault_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo SingleOrDefault_TSource_2(Type TSource) => - (s_SingleOrDefault_TSource_2 ??= new Func, Expression>, object?>(Queryable.SingleOrDefault).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_SingleOrDefault_TSource_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo SingleOrDefault_TSource_3(Type TSource) => - (s_SingleOrDefault_TSource_3 ??= new Func, object, object>(Queryable.SingleOrDefault).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_SingleOrDefault_TSource_4; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo SingleOrDefault_TSource_4(Type TSource) => - (s_SingleOrDefault_TSource_4 ??= new Func, Expression>, object, object>(Queryable.SingleOrDefault).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Skip_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Skip_TSource_2(Type TSource) => - (s_Skip_TSource_2 ??= new Func, int, IQueryable>(Queryable.Skip).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_SkipWhile_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo SkipWhile_TSource_2(Type TSource) => - (s_SkipWhile_TSource_2 ??= new Func, Expression>, IQueryable>(Queryable.SkipWhile).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_SkipWhile_Index_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo SkipWhile_Index_TSource_2(Type TSource) => - (s_SkipWhile_Index_TSource_2 ??= new Func, Expression>, IQueryable>(Queryable.SkipWhile).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Sum_Int32_1; - - public static MethodInfo Sum_Int32_1 => - s_Sum_Int32_1 ??= new Func, int>(Queryable.Sum).GetMethodInfo(); - - private static MethodInfo? s_Sum_NullableInt32_1; - - public static MethodInfo Sum_NullableInt32_1 => - s_Sum_NullableInt32_1 ??= new Func, int?>(Queryable.Sum).GetMethodInfo(); - - private static MethodInfo? s_Sum_Int64_1; - - public static MethodInfo Sum_Int64_1 => - s_Sum_Int64_1 ??= new Func, long>(Queryable.Sum).GetMethodInfo(); - - private static MethodInfo? s_Sum_NullableInt64_1; - - public static MethodInfo Sum_NullableInt64_1 => - s_Sum_NullableInt64_1 ??= new Func, long?>(Queryable.Sum).GetMethodInfo(); - - private static MethodInfo? s_Sum_Single_1; - - public static MethodInfo Sum_Single_1 => - s_Sum_Single_1 ??= new Func, float>(Queryable.Sum).GetMethodInfo(); - - private static MethodInfo? s_Sum_NullableSingle_1; - - public static MethodInfo Sum_NullableSingle_1 => - s_Sum_NullableSingle_1 ??= new Func, float?>(Queryable.Sum).GetMethodInfo(); - - private static MethodInfo? s_Sum_Double_1; - - public static MethodInfo Sum_Double_1 => - s_Sum_Double_1 ??= new Func, double>(Queryable.Sum).GetMethodInfo(); - - private static MethodInfo? s_Sum_NullableDouble_1; - - public static MethodInfo Sum_NullableDouble_1 => - s_Sum_NullableDouble_1 ??= new Func, double?>(Queryable.Sum).GetMethodInfo(); - - private static MethodInfo? s_Sum_Decimal_1; - - public static MethodInfo Sum_Decimal_1 => - s_Sum_Decimal_1 ??= new Func, decimal>(Queryable.Sum).GetMethodInfo(); - - private static MethodInfo? s_Sum_NullableDecimal_1; - - public static MethodInfo Sum_NullableDecimal_1 => - s_Sum_NullableDecimal_1 ??= new Func, decimal?>(Queryable.Sum).GetMethodInfo(); - - private static MethodInfo? s_Sum_NullableDecimal_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Sum_NullableDecimal_TSource_2(Type TSource) => - (s_Sum_NullableDecimal_TSource_2 ??= new Func, Expression>, decimal?>(Queryable.Sum).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Sum_Int32_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Sum_Int32_TSource_2(Type TSource) => - (s_Sum_Int32_TSource_2 ??= new Func, Expression>, int>(Queryable.Sum).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Sum_NullableInt32_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Sum_NullableInt32_TSource_2(Type TSource) => - (s_Sum_NullableInt32_TSource_2 ??= new Func, Expression>, int?>(Queryable.Sum).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Sum_Int64_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Sum_Int64_TSource_2(Type TSource) => - (s_Sum_Int64_TSource_2 ??= new Func, Expression>, long>(Queryable.Sum).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Sum_NullableInt64_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Sum_NullableInt64_TSource_2(Type TSource) => - (s_Sum_NullableInt64_TSource_2 ??= new Func, Expression>, long?>(Queryable.Sum).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Sum_Single_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Sum_Single_TSource_2(Type TSource) => - (s_Sum_Single_TSource_2 ??= new Func, Expression>, float>(Queryable.Sum).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Sum_NullableSingle_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Sum_NullableSingle_TSource_2(Type TSource) => - (s_Sum_NullableSingle_TSource_2 ??= new Func, Expression>, float?>(Queryable.Sum).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Sum_Double_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Sum_Double_TSource_2(Type TSource) => - (s_Sum_Double_TSource_2 ??= new Func, Expression>, double>(Queryable.Sum).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Sum_NullableDouble_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Sum_NullableDouble_TSource_2(Type TSource) => - (s_Sum_NullableDouble_TSource_2 ??= new Func, Expression>, double?>(Queryable.Sum).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Sum_Decimal_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Sum_Decimal_TSource_2(Type TSource) => - (s_Sum_Decimal_TSource_2 ??= new Func, Expression>, decimal>(Queryable.Sum).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Take_Int32_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Take_Int32_TSource_2(Type TSource) => - (s_Take_Int32_TSource_2 ??= new Func, int, IQueryable>(Queryable.Take).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Take_Range_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Take_Range_TSource_2(Type TSource) => - (s_Take_Range_TSource_2 ??= new Func, Range, IQueryable>(Queryable.Take).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_TakeWhile_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo TakeWhile_TSource_2(Type TSource) => - (s_TakeWhile_TSource_2 ??= new Func, Expression>, IQueryable>(Queryable.TakeWhile).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_TakeWhile_Index_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo TakeWhile_Index_TSource_2(Type TSource) => - (s_TakeWhile_Index_TSource_2 ??= new Func, Expression>, IQueryable>(Queryable.TakeWhile).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_ThenBy_TSource_TKey_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo ThenBy_TSource_TKey_2(Type TSource, Type TKey) => - (s_ThenBy_TSource_TKey_2 ??= new Func, Expression>, IOrderedQueryable>(Queryable.ThenBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_ThenBy_TSource_TKey_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo ThenBy_TSource_TKey_3(Type TSource, Type TKey) => - (s_ThenBy_TSource_TKey_3 ??= new Func, Expression>, IComparer, IOrderedQueryable>(Queryable.ThenBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_ThenByDescending_TSource_TKey_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo ThenByDescending_TSource_TKey_2(Type TSource, Type TKey) => - (s_ThenByDescending_TSource_TKey_2 ??= new Func, Expression>, IOrderedQueryable>(Queryable.ThenByDescending).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_ThenByDescending_TSource_TKey_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo ThenByDescending_TSource_TKey_3(Type TSource, Type TKey) => - (s_ThenByDescending_TSource_TKey_3 ??= new Func, Expression>, IComparer, IOrderedQueryable>(Queryable.ThenByDescending).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_Union_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Union_TSource_2(Type TSource) => - (s_Union_TSource_2 ??= new Func, IEnumerable, IQueryable>(Queryable.Union).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Union_TSource_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Union_TSource_3(Type TSource) => - (s_Union_TSource_3 ??= new Func, IEnumerable, IEqualityComparer, IQueryable>(Queryable.Union).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_UnionBy_TSource_TKey_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo UnionBy_TSource_TKey_3(Type TSource, Type TKey) => - (s_UnionBy_TSource_TKey_3 ??= new Func, IEnumerable, Expression>, IQueryable>(Queryable.UnionBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_UnionBy_TSource_TKey_4; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo UnionBy_TSource_TKey_4(Type TSource, Type TKey) => - (s_UnionBy_TSource_TKey_4 ??= new Func, IEnumerable, Expression>, IEqualityComparer, IQueryable>(Queryable.UnionBy).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource, TKey); - - private static MethodInfo? s_Where_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Where_TSource_2(Type TSource) => - (s_Where_TSource_2 ??= new Func, Expression>, IQueryable>(Queryable.Where).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Where_Index_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Where_Index_TSource_2(Type TSource) => - (s_Where_Index_TSource_2 ??= new Func, Expression>, IQueryable>(Queryable.Where).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Zip_TFirst_TSecond_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Zip_TFirst_TSecond_2(Type TFirst, Type TSecond) => - (s_Zip_TFirst_TSecond_2 ??= new Func, IEnumerable, IQueryable<(object, object)>>(Queryable.Zip).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TFirst, TSecond); - - private static MethodInfo? s_Zip_TFirst_TSecond_TResult_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Zip_TFirst_TSecond_TResult_3(Type TFirst, Type TSecond, Type TResult) => - (s_Zip_TFirst_TSecond_TResult_3 ??= new Func, IEnumerable, Expression>, IQueryable>(Queryable.Zip).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TFirst, TSecond, TResult); - - private static MethodInfo? s_Zip_TFirst_TSecond_TThird_3; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Zip_TFirst_TSecond_TThird_3(Type TFirst, Type TSecond, Type TThird) => - (s_Zip_TFirst_TSecond_TThird_3 ??= new Func, IEnumerable, IEnumerable, IQueryable<(object, object, object)>>(Queryable.Zip).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TFirst, TSecond, TThird); - - - private static MethodInfo? s_SkipLast_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo SkipLast_TSource_2(Type TSource) => - (s_SkipLast_TSource_2 ??= new Func, int, IQueryable>(Queryable.SkipLast).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_TakeLast_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo TakeLast_TSource_2(Type TSource) => - (s_TakeLast_TSource_2 ??= new Func, int, IQueryable>(Queryable.TakeLast).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Append_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Append_TSource_2(Type TSource) => - (s_Append_TSource_2 ??= new Func, object, IQueryable>(Queryable.Append).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - - private static MethodInfo? s_Prepend_TSource_2; - - [RequiresDynamicCode("Calls System.Reflection.MethodInfo.MakeGenericMethod(params Type[])")] - public static MethodInfo Prepend_TSource_2(Type TSource) => - (s_Prepend_TSource_2 ??= new Func, object, IQueryable>(Queryable.Prepend).GetMethodInfo().GetGenericMethodDefinition()) - .MakeGenericMethod(TSource); - } -} diff --git a/src/libraries/System.Linq.Queryable/src/System/Linq/Queryable.cs b/src/libraries/System.Linq.Queryable/src/System/Linq/Queryable.cs index 343899581156b..a43ec6c60ae7b 100644 --- a/src/libraries/System.Linq.Queryable/src/System/Linq/Queryable.cs +++ b/src/libraries/System.Linq.Queryable/src/System/Linq/Queryable.cs @@ -11,7 +11,7 @@ namespace System.Linq public static class Queryable { internal const string InMemoryQueryableExtensionMethodsRequiresUnreferencedCode = "Enumerating in-memory collections as IQueryable can require unreferenced code because expressions referencing IQueryable extension methods can get rebound to IEnumerable extension methods. The IEnumerable extension methods could be trimmed causing the application to fail at runtime."; - internal const string InMemoryQueryableExtensionMethodsRequiresDynamicCode = "Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling."; + internal const string InMemoryQueryableExtensionMethodsRequiresDynamicCode = "Enumerating in-memory collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling."; [RequiresUnreferencedCode(InMemoryQueryableExtensionMethodsRequiresUnreferencedCode)] [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] @@ -43,7 +43,6 @@ public static IQueryable AsQueryable(this IEnumerable source) } [DynamicDependency("Where`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Where(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -52,13 +51,11 @@ public static IQueryable Where(this IQueryable source return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Where_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, IQueryable>(Where).Method, + source.Expression, Expression.Quote(predicate))); } [DynamicDependency("Where`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Where(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -67,13 +64,11 @@ public static IQueryable Where(this IQueryable source return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Where_Index_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, IQueryable>(Where).Method, + source.Expression, Expression.Quote(predicate))); } [DynamicDependency("OfType`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable OfType(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -81,11 +76,11 @@ public static IQueryable OfType(this IQueryable source) return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.OfType_TResult_1(typeof(TResult)), source.Expression)); + new Func>(OfType).Method, + source.Expression)); } [DynamicDependency("Cast`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Cast(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -93,11 +88,11 @@ public static IQueryable Cast(this IQueryable source) return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Cast_TResult_1(typeof(TResult)), source.Expression)); + new Func>(Cast).Method, + source.Expression)); } [DynamicDependency("Select`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Select(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -106,13 +101,11 @@ public static IQueryable Select(this IQueryable( Expression.Call( null, - CachedReflectionInfo.Select_TSource_TResult_2(typeof(TSource), typeof(TResult)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, IQueryable>(Select).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Select`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Select(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -121,13 +114,11 @@ public static IQueryable Select(this IQueryable( Expression.Call( null, - CachedReflectionInfo.Select_Index_TSource_TResult_2(typeof(TSource), typeof(TResult)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, IQueryable>(Select).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("SelectMany`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable SelectMany(this IQueryable source, Expression>> selector) { ArgumentNullException.ThrowIfNull(source); @@ -136,13 +127,11 @@ public static IQueryable SelectMany(this IQueryable( Expression.Call( null, - CachedReflectionInfo.SelectMany_TSource_TResult_2(typeof(TSource), typeof(TResult)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>>, IQueryable>(SelectMany).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("SelectMany`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable SelectMany(this IQueryable source, Expression>> selector) { ArgumentNullException.ThrowIfNull(source); @@ -151,13 +140,11 @@ public static IQueryable SelectMany(this IQueryable( Expression.Call( null, - CachedReflectionInfo.SelectMany_Index_TSource_TResult_2(typeof(TSource), typeof(TResult)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>>, IQueryable>(SelectMany).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("SelectMany`3", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable SelectMany(this IQueryable source, Expression>> collectionSelector, Expression> resultSelector) { ArgumentNullException.ThrowIfNull(source); @@ -167,13 +154,11 @@ public static IQueryable SelectMany(this return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.SelectMany_Index_TSource_TCollection_TResult_3(typeof(TSource), typeof(TCollection), typeof(TResult)), - source.Expression, Expression.Quote(collectionSelector), Expression.Quote(resultSelector) - )); + new Func, Expression>>, Expression>, IQueryable>(SelectMany).Method, + source.Expression, Expression.Quote(collectionSelector), Expression.Quote(resultSelector))); } [DynamicDependency("SelectMany`3", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable SelectMany(this IQueryable source, Expression>> collectionSelector, Expression> resultSelector) { ArgumentNullException.ThrowIfNull(source); @@ -183,9 +168,8 @@ public static IQueryable SelectMany(this return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.SelectMany_TSource_TCollection_TResult_3(typeof(TSource), typeof(TCollection), typeof(TResult)), - source.Expression, Expression.Quote(collectionSelector), Expression.Quote(resultSelector) - )); + new Func, Expression>>, Expression>, IQueryable>(SelectMany).Method, + source.Expression, Expression.Quote(collectionSelector), Expression.Quote(resultSelector))); } private static Expression GetSourceExpression(IEnumerable source) @@ -195,7 +179,6 @@ private static Expression GetSourceExpression(IEnumerable sour } [DynamicDependency("Join`4", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Join(this IQueryable outer, IEnumerable inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression> resultSelector) { ArgumentNullException.ThrowIfNull(outer); @@ -207,11 +190,11 @@ public static IQueryable Join(this IQuer return outer.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Join_TOuter_TInner_TKey_TResult_5(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector))); + new Func, IEnumerable, Expression>, Expression>, Expression>, IQueryable>(Join).Method, + outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector))); } [DynamicDependency("Join`4", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Join(this IQueryable outer, IEnumerable inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression> resultSelector, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(outer); @@ -223,11 +206,11 @@ public static IQueryable Join(this IQuer return outer.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Join_TOuter_TInner_TKey_TResult_6(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer)))); + new Func, IEnumerable, Expression>, Expression>, Expression>, IEqualityComparer, IQueryable>(Join).Method, + outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer)))); } [DynamicDependency("GroupJoin`4", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable GroupJoin(this IQueryable outer, IEnumerable inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression, TResult>> resultSelector) { ArgumentNullException.ThrowIfNull(outer); @@ -239,11 +222,11 @@ public static IQueryable GroupJoin(this return outer.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.GroupJoin_TOuter_TInner_TKey_TResult_5(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector))); + new Func, IEnumerable, Expression>, Expression>, Expression, TResult>>, IQueryable>(GroupJoin).Method, + outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector))); } [DynamicDependency("GroupJoin`4", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable GroupJoin(this IQueryable outer, IEnumerable inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression, TResult>> resultSelector, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(outer); @@ -255,7 +238,8 @@ public static IQueryable GroupJoin(this return outer.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.GroupJoin_TOuter_TInner_TKey_TResult_6(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer)))); + new Func, IEnumerable, Expression>, Expression>, Expression, TResult>>, IEqualityComparer, IQueryable>(GroupJoin).Method, + outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer)))); } /// @@ -283,7 +267,6 @@ public static IQueryable GroupJoin(this /// The expected behavior is that it sorts the elements of by itself. /// [DynamicDependency("Order`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IOrderedQueryable Order(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -291,9 +274,8 @@ public static IOrderedQueryable Order(this IQueryable source) return (IOrderedQueryable)source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Order_T_1(typeof(T)), - source.Expression - )); + new Func, IOrderedQueryable>(Order).Method, + source.Expression)); } /// @@ -322,7 +304,6 @@ public static IOrderedQueryable Order(this IQueryable source) /// The expected behavior is that it sorts the elements of by itself. /// [DynamicDependency("Order`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IOrderedQueryable Order(this IQueryable source, IComparer comparer) { ArgumentNullException.ThrowIfNull(source); @@ -330,13 +311,11 @@ public static IOrderedQueryable Order(this IQueryable source, IComparer return (IOrderedQueryable)source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Order_T_2(typeof(T)), - source.Expression, Expression.Constant(comparer, typeof(IComparer)) - )); + new Func, IComparer, IOrderedQueryable>(Order).Method, + source.Expression, Expression.Constant(comparer, typeof(IComparer)))); } [DynamicDependency("OrderBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IOrderedQueryable OrderBy(this IQueryable source, Expression> keySelector) { ArgumentNullException.ThrowIfNull(source); @@ -345,13 +324,11 @@ public static IOrderedQueryable OrderBy(this IQueryable< return (IOrderedQueryable)source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.OrderBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), - source.Expression, Expression.Quote(keySelector) - )); + new Func, Expression>, IOrderedQueryable>(OrderBy).Method, + source.Expression, Expression.Quote(keySelector))); } [DynamicDependency("OrderBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IOrderedQueryable OrderBy(this IQueryable source, Expression> keySelector, IComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -360,9 +337,8 @@ public static IOrderedQueryable OrderBy(this IQueryable< return (IOrderedQueryable)source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.OrderBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), - source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer)) - )); + new Func, Expression>, IComparer, IOrderedQueryable>(OrderBy).Method, + source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer)))); } /// @@ -390,7 +366,6 @@ public static IOrderedQueryable OrderBy(this IQueryable< /// The expected behavior is that it sorts the elements of by itself. /// [DynamicDependency("OrderDescending`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IOrderedQueryable OrderDescending(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -398,9 +373,8 @@ public static IOrderedQueryable OrderDescending(this IQueryable source) return (IOrderedQueryable)source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.OrderDescending_T_1(typeof(T)), - source.Expression - )); + new Func, IOrderedQueryable>(OrderDescending).Method, + source.Expression)); } /// @@ -429,7 +403,6 @@ public static IOrderedQueryable OrderDescending(this IQueryable source) /// The expected behavior is that it sorts the elements of by itself. /// [DynamicDependency("OrderDescending`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IOrderedQueryable OrderDescending(this IQueryable source, IComparer comparer) { ArgumentNullException.ThrowIfNull(source); @@ -437,13 +410,11 @@ public static IOrderedQueryable OrderDescending(this IQueryable source, return (IOrderedQueryable)source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.OrderDescending_T_2(typeof(T)), - source.Expression, Expression.Constant(comparer, typeof(IComparer)) - )); + new Func, IComparer, IOrderedQueryable>(OrderDescending).Method, + source.Expression, Expression.Constant(comparer, typeof(IComparer)))); } [DynamicDependency("OrderByDescending`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IOrderedQueryable OrderByDescending(this IQueryable source, Expression> keySelector) { ArgumentNullException.ThrowIfNull(source); @@ -452,13 +423,11 @@ public static IOrderedQueryable OrderByDescending(this I return (IOrderedQueryable)source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.OrderByDescending_TSource_TKey_2(typeof(TSource), typeof(TKey)), - source.Expression, Expression.Quote(keySelector) - )); + new Func, Expression>, IOrderedQueryable>(OrderByDescending).Method, + source.Expression, Expression.Quote(keySelector))); } [DynamicDependency("OrderByDescending`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IOrderedQueryable OrderByDescending(this IQueryable source, Expression> keySelector, IComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -467,13 +436,11 @@ public static IOrderedQueryable OrderByDescending(this I return (IOrderedQueryable)source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.OrderByDescending_TSource_TKey_3(typeof(TSource), typeof(TKey)), - source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer)) - )); + new Func, Expression>, IComparer, IOrderedQueryable>(OrderByDescending).Method, + source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer)))); } [DynamicDependency("ThenBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IOrderedQueryable ThenBy(this IOrderedQueryable source, Expression> keySelector) { ArgumentNullException.ThrowIfNull(source); @@ -482,13 +449,11 @@ public static IOrderedQueryable ThenBy(this IOrderedQuer return (IOrderedQueryable)source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.ThenBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), - source.Expression, Expression.Quote(keySelector) - )); + new Func, Expression>, IOrderedQueryable>(ThenBy).Method, + source.Expression, Expression.Quote(keySelector))); } [DynamicDependency("ThenBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IOrderedQueryable ThenBy(this IOrderedQueryable source, Expression> keySelector, IComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -497,13 +462,11 @@ public static IOrderedQueryable ThenBy(this IOrderedQuer return (IOrderedQueryable)source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.ThenBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), - source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer)) - )); + new Func, Expression>, IComparer, IOrderedQueryable>(ThenBy).Method, + source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer)))); } [DynamicDependency("ThenByDescending`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IOrderedQueryable ThenByDescending(this IOrderedQueryable source, Expression> keySelector) { ArgumentNullException.ThrowIfNull(source); @@ -512,13 +475,11 @@ public static IOrderedQueryable ThenByDescending(this IO return (IOrderedQueryable)source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.ThenByDescending_TSource_TKey_2(typeof(TSource), typeof(TKey)), - source.Expression, Expression.Quote(keySelector) - )); + new Func, Expression>, IOrderedQueryable>(ThenByDescending).Method, + source.Expression, Expression.Quote(keySelector))); } [DynamicDependency("ThenByDescending`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IOrderedQueryable ThenByDescending(this IOrderedQueryable source, Expression> keySelector, IComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -527,13 +488,11 @@ public static IOrderedQueryable ThenByDescending(this IO return (IOrderedQueryable)source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.ThenByDescending_TSource_TKey_3(typeof(TSource), typeof(TKey)), - source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer)) - )); + new Func, Expression>, IComparer, IOrderedQueryable>(ThenByDescending).Method, + source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer)))); } [DynamicDependency("Take`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Take(this IQueryable source, int count) { ArgumentNullException.ThrowIfNull(source); @@ -541,9 +500,8 @@ public static IQueryable Take(this IQueryable source, return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Take_Int32_TSource_2(typeof(TSource)), - source.Expression, Expression.Constant(count) - )); + new Func, int, IQueryable>(Take).Method, + source.Expression, Expression.Constant(count))); } /// Returns a specified range of contiguous elements from a sequence. @@ -553,7 +511,6 @@ public static IQueryable Take(this IQueryable source, /// is . /// An that contains the specified of elements from the sequence. [DynamicDependency("Take`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Take(this IQueryable source, Range range) { ArgumentNullException.ThrowIfNull(source); @@ -561,13 +518,11 @@ public static IQueryable Take(this IQueryable source, return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Take_Range_TSource_2(typeof(TSource)), - source.Expression, Expression.Constant(range) - )); + new Func, Range, IQueryable>(Take).Method, + source.Expression, Expression.Constant(range))); } [DynamicDependency("TakeWhile`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable TakeWhile(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -576,13 +531,11 @@ public static IQueryable TakeWhile(this IQueryable so return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.TakeWhile_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, IQueryable>(TakeWhile).Method, + source.Expression, Expression.Quote(predicate))); } [DynamicDependency("TakeWhile`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable TakeWhile(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -591,13 +544,11 @@ public static IQueryable TakeWhile(this IQueryable so return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.TakeWhile_Index_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, IQueryable>(TakeWhile).Method, + source.Expression, Expression.Quote(predicate))); } [DynamicDependency("Skip`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Skip(this IQueryable source, int count) { ArgumentNullException.ThrowIfNull(source); @@ -605,13 +556,11 @@ public static IQueryable Skip(this IQueryable source, return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Skip_TSource_2(typeof(TSource)), - source.Expression, Expression.Constant(count) - )); + new Func, int, IQueryable>(Skip).Method, + source.Expression, Expression.Constant(count))); } [DynamicDependency("SkipWhile`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable SkipWhile(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -620,13 +569,11 @@ public static IQueryable SkipWhile(this IQueryable so return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.SkipWhile_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, IQueryable>(SkipWhile).Method, + source.Expression, Expression.Quote(predicate))); } [DynamicDependency("SkipWhile`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable SkipWhile(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -635,13 +582,11 @@ public static IQueryable SkipWhile(this IQueryable so return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.SkipWhile_Index_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, IQueryable>(SkipWhile).Method, + source.Expression, Expression.Quote(predicate))); } [DynamicDependency("GroupBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable> GroupBy(this IQueryable source, Expression> keySelector) { ArgumentNullException.ThrowIfNull(source); @@ -650,13 +595,11 @@ public static IQueryable> GroupBy(this I return source.Provider.CreateQuery>( Expression.Call( null, - CachedReflectionInfo.GroupBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), - source.Expression, Expression.Quote(keySelector) - )); + new Func, Expression>, IQueryable>>(GroupBy).Method, + source.Expression, Expression.Quote(keySelector))); } [DynamicDependency("GroupBy`3", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable> GroupBy(this IQueryable source, Expression> keySelector, Expression> elementSelector) { ArgumentNullException.ThrowIfNull(source); @@ -666,13 +609,11 @@ public static IQueryable> GroupBy>( Expression.Call( null, - CachedReflectionInfo.GroupBy_TSource_TKey_TElement_3(typeof(TSource), typeof(TKey), typeof(TElement)), - source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector) - )); + new Func, Expression>, Expression>, IQueryable>>(GroupBy).Method, + source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector))); } [DynamicDependency("GroupBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable> GroupBy(this IQueryable source, Expression> keySelector, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -681,13 +622,11 @@ public static IQueryable> GroupBy(this I return source.Provider.CreateQuery>( Expression.Call( null, - CachedReflectionInfo.GroupBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), - source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IEqualityComparer)) - )); + new Func, Expression>, IEqualityComparer, IQueryable>>(GroupBy).Method, + source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IEqualityComparer)))); } [DynamicDependency("GroupBy`3", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable> GroupBy(this IQueryable source, Expression> keySelector, Expression> elementSelector, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -697,11 +636,11 @@ public static IQueryable> GroupBy>( Expression.Call( null, - CachedReflectionInfo.GroupBy_TSource_TKey_TElement_4(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Constant(comparer, typeof(IEqualityComparer)))); + new Func, Expression>, Expression>, IEqualityComparer, IQueryable>>(GroupBy).Method, + source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Constant(comparer, typeof(IEqualityComparer)))); } [DynamicDependency("GroupBy`4", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable GroupBy(this IQueryable source, Expression> keySelector, Expression> elementSelector, Expression, TResult>> resultSelector) { ArgumentNullException.ThrowIfNull(source); @@ -712,11 +651,11 @@ public static IQueryable GroupBy(this return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.GroupBy_TSource_TKey_TElement_TResult_4(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Quote(resultSelector))); + new Func, Expression>, Expression>, Expression, TResult>>, IQueryable>(GroupBy).Method, + source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Quote(resultSelector))); } [DynamicDependency("GroupBy`3", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable GroupBy(this IQueryable source, Expression> keySelector, Expression, TResult>> resultSelector) { ArgumentNullException.ThrowIfNull(source); @@ -726,13 +665,11 @@ public static IQueryable GroupBy(this IQueryabl return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.GroupBy_TSource_TKey_TResult_3(typeof(TSource), typeof(TKey), typeof(TResult)), - source.Expression, Expression.Quote(keySelector), Expression.Quote(resultSelector) - )); + new Func, Expression>, Expression, TResult>>, IQueryable>(GroupBy).Method, + source.Expression, Expression.Quote(keySelector), Expression.Quote(resultSelector))); } [DynamicDependency("GroupBy`3", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable GroupBy(this IQueryable source, Expression> keySelector, Expression, TResult>> resultSelector, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -742,11 +679,11 @@ public static IQueryable GroupBy(this IQueryabl return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.GroupBy_TSource_TKey_TResult_4(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, Expression.Quote(keySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer)))); + new Func, Expression>, Expression, TResult>>, IEqualityComparer, IQueryable>(GroupBy).Method, + source.Expression, Expression.Quote(keySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer)))); } [DynamicDependency("GroupBy`4", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable GroupBy(this IQueryable source, Expression> keySelector, Expression> elementSelector, Expression, TResult>> resultSelector, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -757,11 +694,11 @@ public static IQueryable GroupBy(this return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.GroupBy_TSource_TKey_TElement_TResult_5(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer)))); + new Func, Expression>, Expression>, Expression, TResult>>, IEqualityComparer, IQueryable>(GroupBy).Method, + source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer)))); } [DynamicDependency("Distinct`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Distinct(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -769,11 +706,11 @@ public static IQueryable Distinct(this IQueryable sou return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Distinct_TSource_1(typeof(TSource)), source.Expression)); + new Func, IQueryable>(Distinct).Method, + source.Expression)); } [DynamicDependency("Distinct`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Distinct(this IQueryable source, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -781,9 +718,8 @@ public static IQueryable Distinct(this IQueryable sou return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Distinct_TSource_2(typeof(TSource)), - source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer)) - )); + new Func, IEqualityComparer, IQueryable>(Distinct).Method, + source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer)))); } /// Returns distinct elements from a sequence according to a specified key selector function. @@ -794,7 +730,6 @@ public static IQueryable Distinct(this IQueryable sou /// An that contains distinct elements from the source sequence. /// is . [DynamicDependency("DistinctBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable DistinctBy(this IQueryable source, Expression> keySelector) { ArgumentNullException.ThrowIfNull(source); @@ -803,9 +738,8 @@ public static IQueryable DistinctBy(this IQueryable( Expression.Call( null, - CachedReflectionInfo.DistinctBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), - source.Expression, Expression.Quote(keySelector) - )); + new Func, Expression>, IQueryable>(DistinctBy).Method, + source.Expression, Expression.Quote(keySelector))); } /// Returns distinct elements from a sequence according to a specified key selector function. @@ -817,7 +751,6 @@ public static IQueryable DistinctBy(this IQueryableAn that contains distinct elements from the source sequence. /// is . [DynamicDependency("DistinctBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable DistinctBy(this IQueryable source, Expression> keySelector, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -826,9 +759,8 @@ public static IQueryable DistinctBy(this IQueryable( Expression.Call( null, - CachedReflectionInfo.DistinctBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), - source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IEqualityComparer)) - )); + new Func, Expression>, IEqualityComparer, IQueryable>(DistinctBy).Method, + source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IEqualityComparer)))); } /// Split the elements of a sequence into chunks of size at most . @@ -843,7 +775,6 @@ public static IQueryable DistinctBy(this IQueryableThe last chunk will contain the remaining elements and may be of a smaller size. /// [DynamicDependency("Chunk`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Chunk(this IQueryable source, int size) { ArgumentNullException.ThrowIfNull(source); @@ -851,13 +782,11 @@ public static IQueryable Chunk(this IQueryable sour return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Chunk_TSource_1(typeof(TSource)), - source.Expression, Expression.Constant(size) - )); + new Func, int, IQueryable>(Chunk).Method, + source.Expression, Expression.Constant(size))); } [DynamicDependency("Concat`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Concat(this IQueryable source1, IEnumerable source2) { ArgumentNullException.ThrowIfNull(source1); @@ -866,13 +795,11 @@ public static IQueryable Concat(this IQueryable sourc return source1.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Concat_TSource_2(typeof(TSource)), - source1.Expression, GetSourceExpression(source2) - )); + new Func, IEnumerable, IQueryable>(Concat).Method, + source1.Expression, GetSourceExpression(source2))); } [DynamicDependency("Zip`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable<(TFirst First, TSecond Second)> Zip(this IQueryable source1, IEnumerable source2) { ArgumentNullException.ThrowIfNull(source1); @@ -881,12 +808,11 @@ public static IQueryable Concat(this IQueryable sourc return source1.Provider.CreateQuery<(TFirst, TSecond)>( Expression.Call( null, - CachedReflectionInfo.Zip_TFirst_TSecond_2(typeof(TFirst), typeof(TSecond)), + new Func, IEnumerable, IQueryable<(TFirst, TSecond)>>(Zip).Method, source1.Expression, GetSourceExpression(source2))); } [DynamicDependency("Zip`3", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Zip(this IQueryable source1, IEnumerable source2, Expression> resultSelector) { ArgumentNullException.ThrowIfNull(source1); @@ -896,9 +822,8 @@ public static IQueryable Zip(this IQueryable< return source1.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Zip_TFirst_TSecond_TResult_3(typeof(TFirst), typeof(TSecond), typeof(TResult)), - source1.Expression, GetSourceExpression(source2), Expression.Quote(resultSelector) - )); + new Func, IEnumerable, Expression>, IQueryable>(Zip).Method, + source1.Expression, GetSourceExpression(source2), Expression.Quote(resultSelector))); } /// @@ -912,7 +837,6 @@ public static IQueryable Zip(this IQueryable< /// The third sequence to merge. /// A sequence of tuples with elements taken from the first, second and third sequences, in that order. [DynamicDependency("Zip`3", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable<(TFirst First, TSecond Second, TThird Third)> Zip(this IQueryable source1, IEnumerable source2, IEnumerable source3) { ArgumentNullException.ThrowIfNull(source1); @@ -922,13 +846,11 @@ public static IQueryable Zip(this IQueryable< return source1.Provider.CreateQuery<(TFirst, TSecond, TThird)>( Expression.Call( null, - CachedReflectionInfo.Zip_TFirst_TSecond_TThird_3(typeof(TFirst), typeof(TSecond), typeof(TThird)), - source1.Expression, GetSourceExpression(source2), GetSourceExpression(source3) - )); + new Func, IEnumerable, IEnumerable, IQueryable<(TFirst, TSecond, TThird)>>(Zip).Method, + source1.Expression, GetSourceExpression(source2), GetSourceExpression(source3))); } [DynamicDependency("Union`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Union(this IQueryable source1, IEnumerable source2) { ArgumentNullException.ThrowIfNull(source1); @@ -937,13 +859,11 @@ public static IQueryable Union(this IQueryable source return source1.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Union_TSource_2(typeof(TSource)), - source1.Expression, GetSourceExpression(source2) - )); + new Func, IEnumerable, IQueryable>(Union).Method, + source1.Expression, GetSourceExpression(source2))); } [DynamicDependency("Union`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Union(this IQueryable source1, IEnumerable source2, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(source1); @@ -952,11 +872,10 @@ public static IQueryable Union(this IQueryable source return source1.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Union_TSource_3(typeof(TSource)), + new Func, IEnumerable, IEqualityComparer, IQueryable>(Union).Method, source1.Expression, GetSourceExpression(source2), - Expression.Constant(comparer, typeof(IEqualityComparer)) - )); + Expression.Constant(comparer, typeof(IEqualityComparer)))); } /// Produces the set union of two sequences according to a specified key selector function. @@ -968,7 +887,6 @@ public static IQueryable Union(this IQueryable source /// An that contains the elements from both input sequences, excluding duplicates. /// or is . [DynamicDependency("UnionBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable UnionBy(this IQueryable source1, IEnumerable source2, Expression> keySelector) { ArgumentNullException.ThrowIfNull(source1); @@ -978,9 +896,8 @@ public static IQueryable UnionBy(this IQueryable( Expression.Call( null, - CachedReflectionInfo.UnionBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), - source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector) - )); + new Func, IEnumerable, Expression>, IQueryable>(UnionBy).Method, + source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector))); } /// Produces the set union of two sequences according to a specified key selector function. @@ -993,7 +910,6 @@ public static IQueryable UnionBy(this IQueryableAn that contains the elements from both input sequences, excluding duplicates. /// or is . [DynamicDependency("UnionBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable UnionBy(this IQueryable source1, IEnumerable source2, Expression> keySelector, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(source1); @@ -1003,16 +919,14 @@ public static IQueryable UnionBy(this IQueryable( Expression.Call( null, - CachedReflectionInfo.UnionBy_TSource_TKey_4(typeof(TSource), typeof(TKey)), + new Func, IEnumerable, Expression>, IEqualityComparer, IQueryable>(UnionBy).Method, source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector), - Expression.Constant(comparer, typeof(IEqualityComparer)) - )); + Expression.Constant(comparer, typeof(IEqualityComparer)))); } [DynamicDependency("Intersect`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Intersect(this IQueryable source1, IEnumerable source2) { ArgumentNullException.ThrowIfNull(source1); @@ -1021,13 +935,11 @@ public static IQueryable Intersect(this IQueryable so return source1.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Intersect_TSource_2(typeof(TSource)), - source1.Expression, GetSourceExpression(source2) - )); + new Func, IEnumerable, IQueryable>(Intersect).Method, + source1.Expression, GetSourceExpression(source2))); } [DynamicDependency("Intersect`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Intersect(this IQueryable source1, IEnumerable source2, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(source1); @@ -1036,11 +948,10 @@ public static IQueryable Intersect(this IQueryable so return source1.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Intersect_TSource_3(typeof(TSource)), + new Func, IEnumerable, IEqualityComparer, IQueryable>(Intersect).Method, source1.Expression, GetSourceExpression(source2), - Expression.Constant(comparer, typeof(IEqualityComparer)) - )); + Expression.Constant(comparer, typeof(IEqualityComparer)))); } /// Produces the set intersection of two sequences according to a specified key selector function. @@ -1052,7 +963,6 @@ public static IQueryable Intersect(this IQueryable so /// A sequence that contains the elements that form the set intersection of two sequences. /// or is . [DynamicDependency("IntersectBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable IntersectBy(this IQueryable source1, IEnumerable source2, Expression> keySelector) { ArgumentNullException.ThrowIfNull(source1); @@ -1062,11 +972,10 @@ public static IQueryable IntersectBy(this IQueryable( Expression.Call( null, - CachedReflectionInfo.IntersectBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), + new Func, IEnumerable, Expression>, IQueryable>(IntersectBy).Method, source1.Expression, GetSourceExpression(source2), - Expression.Quote(keySelector) - )); + Expression.Quote(keySelector))); } /// Produces the set intersection of two sequences according to a specified key selector function. @@ -1079,7 +988,6 @@ public static IQueryable IntersectBy(this IQueryableA sequence that contains the elements that form the set intersection of two sequences. /// or is . [DynamicDependency("IntersectBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable IntersectBy(this IQueryable source1, IEnumerable source2, Expression> keySelector, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(source1); @@ -1089,16 +997,14 @@ public static IQueryable IntersectBy(this IQueryable( Expression.Call( null, - CachedReflectionInfo.IntersectBy_TSource_TKey_4(typeof(TSource), typeof(TKey)), + new Func, IEnumerable, Expression>, IEqualityComparer, IQueryable>(IntersectBy).Method, source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector), - Expression.Constant(comparer, typeof(IEqualityComparer)) - )); + Expression.Constant(comparer, typeof(IEqualityComparer)))); } [DynamicDependency("Except`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Except(this IQueryable source1, IEnumerable source2) { ArgumentNullException.ThrowIfNull(source1); @@ -1107,13 +1013,11 @@ public static IQueryable Except(this IQueryable sourc return source1.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Except_TSource_2(typeof(TSource)), - source1.Expression, GetSourceExpression(source2) - )); + new Func, IEnumerable, IQueryable>(Except).Method, + source1.Expression, GetSourceExpression(source2))); } [DynamicDependency("Except`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Except(this IQueryable source1, IEnumerable source2, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(source1); @@ -1122,11 +1026,10 @@ public static IQueryable Except(this IQueryable sourc return source1.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Except_TSource_3(typeof(TSource)), + new Func, IEnumerable, IEqualityComparer, IQueryable>(Except).Method, source1.Expression, GetSourceExpression(source2), - Expression.Constant(comparer, typeof(IEqualityComparer)) - )); + Expression.Constant(comparer, typeof(IEqualityComparer)))); } /// @@ -1139,7 +1042,6 @@ public static IQueryable Except(this IQueryable sourc /// A function to extract the key for each element. /// A that contains the set difference of the elements of two sequences. [DynamicDependency("ExceptBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable ExceptBy(this IQueryable source1, IEnumerable source2, Expression> keySelector) { ArgumentNullException.ThrowIfNull(source1); @@ -1149,11 +1051,10 @@ public static IQueryable ExceptBy(this IQueryable( Expression.Call( null, - CachedReflectionInfo.ExceptBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), + new Func, IEnumerable, Expression>, IQueryable>(ExceptBy).Method, source1.Expression, GetSourceExpression(source2), - Expression.Quote(keySelector) - )); + Expression.Quote(keySelector))); } /// @@ -1167,7 +1068,6 @@ public static IQueryable ExceptBy(this IQueryableAn to compare keys. /// A that contains the set difference of the elements of two sequences. [DynamicDependency("ExceptBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable ExceptBy(this IQueryable source1, IEnumerable source2, Expression> keySelector, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(source1); @@ -1177,16 +1077,14 @@ public static IQueryable ExceptBy(this IQueryable( Expression.Call( null, - CachedReflectionInfo.ExceptBy_TSource_TKey_4(typeof(TSource), typeof(TKey)), + new Func, IEnumerable, Expression>, IEqualityComparer, IQueryable>(ExceptBy).Method, source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector), - Expression.Constant(comparer, typeof(IEqualityComparer)) - )); + Expression.Constant(comparer, typeof(IEqualityComparer)))); } [DynamicDependency("First`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource First(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -1194,11 +1092,11 @@ public static TSource First(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.First_TSource_1(typeof(TSource)), source.Expression)); + new Func, TSource>(First).Method, + source.Expression)); } [DynamicDependency("First`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource First(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -1207,13 +1105,11 @@ public static TSource First(this IQueryable source, Expression return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.First_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, TSource>(First).Method, + source.Expression, Expression.Quote(predicate))); } [DynamicDependency("FirstOrDefault`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? FirstOrDefault(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -1221,7 +1117,8 @@ public static TSource First(this IQueryable source, Expression return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.FirstOrDefault_TSource_1(typeof(TSource)), source.Expression)); + new Func, TSource?>(FirstOrDefault).Method, + source.Expression)); } /// Returns the first element of a sequence, or a default value if the sequence contains no elements. @@ -1231,7 +1128,6 @@ public static TSource First(this IQueryable source, Expression /// if is empty; otherwise, the first element in . /// is . [DynamicDependency("FirstOrDefault`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource FirstOrDefault(this IQueryable source, TSource defaultValue) { ArgumentNullException.ThrowIfNull(source); @@ -1239,12 +1135,11 @@ public static TSource FirstOrDefault(this IQueryable source, T return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.FirstOrDefault_TSource_3(typeof(TSource)), + new Func, TSource, TSource>(FirstOrDefault).Method, source.Expression, Expression.Constant(defaultValue, typeof(TSource)))); } [DynamicDependency("FirstOrDefault`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? FirstOrDefault(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -1253,9 +1148,8 @@ public static TSource FirstOrDefault(this IQueryable source, T return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.FirstOrDefault_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, TSource?>(FirstOrDefault).Method, + source.Expression, Expression.Quote(predicate))); } /// Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. @@ -1266,7 +1160,6 @@ public static TSource FirstOrDefault(this IQueryable source, T /// if is empty or if no element passes the test specified by ; otherwise, the first element in that passes the test specified by . /// or is . [DynamicDependency("FirstOrDefault`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource FirstOrDefault(this IQueryable source, Expression> predicate, TSource defaultValue) { ArgumentNullException.ThrowIfNull(source); @@ -1275,13 +1168,11 @@ public static TSource FirstOrDefault(this IQueryable source, E return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.FirstOrDefault_TSource_4(typeof(TSource)), - source.Expression, Expression.Quote(predicate), Expression.Constant(defaultValue, typeof(TSource)) - )); + new Func, Expression>, TSource, TSource>(FirstOrDefault).Method, + source.Expression, Expression.Quote(predicate), Expression.Constant(defaultValue, typeof(TSource)))); } [DynamicDependency("Last`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource Last(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -1289,11 +1180,11 @@ public static TSource Last(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Last_TSource_1(typeof(TSource)), source.Expression)); + new Func, TSource>(Last).Method, + source.Expression)); } [DynamicDependency("Last`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource Last(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -1302,13 +1193,11 @@ public static TSource Last(this IQueryable source, Expression< return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Last_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, TSource>(Last).Method, + source.Expression, Expression.Quote(predicate))); } [DynamicDependency("LastOrDefault`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? LastOrDefault(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -1316,7 +1205,8 @@ public static TSource Last(this IQueryable source, Expression< return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.LastOrDefault_TSource_1(typeof(TSource)), source.Expression)); + new Func, TSource?>(LastOrDefault).Method, + source.Expression)); } /// Returns the last element of a sequence, or a default value if the sequence contains no elements. @@ -1326,7 +1216,6 @@ public static TSource Last(this IQueryable source, Expression< /// if the source sequence is empty; otherwise, the last element in the . /// is . [DynamicDependency("LastOrDefault`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource LastOrDefault(this IQueryable source, TSource defaultValue) { ArgumentNullException.ThrowIfNull(source); @@ -1334,12 +1223,11 @@ public static TSource LastOrDefault(this IQueryable source, TS return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.LastOrDefault_TSource_3(typeof(TSource)), + new Func, TSource, TSource>(LastOrDefault).Method, source.Expression, Expression.Constant(defaultValue, typeof(TSource)))); } [DynamicDependency("LastOrDefault`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? LastOrDefault(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -1348,9 +1236,8 @@ public static TSource LastOrDefault(this IQueryable source, TS return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.LastOrDefault_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, TSource?>(LastOrDefault).Method, + source.Expression, Expression.Quote(predicate))); } /// Returns the last element of a sequence that satisfies a condition or a default value if no such element is found. @@ -1361,7 +1248,6 @@ public static TSource LastOrDefault(this IQueryable source, TS /// 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. /// or is . [DynamicDependency("LastOrDefault`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource LastOrDefault(this IQueryable source, Expression> predicate, TSource defaultValue) { ArgumentNullException.ThrowIfNull(source); @@ -1370,13 +1256,12 @@ public static TSource LastOrDefault(this IQueryable source, Ex return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.LastOrDefault_TSource_4(typeof(TSource)), + new Func, Expression>, TSource, TSource>(LastOrDefault).Method, source.Expression, Expression.Quote(predicate), Expression.Constant(defaultValue, typeof(TSource)) )); } [DynamicDependency("Single`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource Single(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -1384,11 +1269,11 @@ public static TSource Single(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Single_TSource_1(typeof(TSource)), source.Expression)); + new Func, TSource>(Single).Method, + source.Expression)); } [DynamicDependency("Single`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource Single(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -1397,13 +1282,11 @@ public static TSource Single(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Single_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, TSource>(Single).Method, + source.Expression, Expression.Quote(predicate))); } [DynamicDependency("SingleOrDefault`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? SingleOrDefault(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -1411,7 +1294,8 @@ public static TSource Single(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.SingleOrDefault_TSource_1(typeof(TSource)), source.Expression)); + new Func, TSource?>(SingleOrDefault).Method, + source.Expression)); } /// 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. @@ -1422,7 +1306,6 @@ public static TSource Single(this IQueryable source, Expressio /// is . /// The input sequence contains more than one element. [DynamicDependency("SingleOrDefault`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource SingleOrDefault(this IQueryable source, TSource defaultValue) { ArgumentNullException.ThrowIfNull(source); @@ -1430,12 +1313,11 @@ public static TSource SingleOrDefault(this IQueryable source, return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.SingleOrDefault_TSource_3(typeof(TSource)), + new Func, TSource, TSource>(SingleOrDefault).Method, source.Expression, Expression.Constant(defaultValue, typeof(TSource)))); } [DynamicDependency("SingleOrDefault`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? SingleOrDefault(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -1444,9 +1326,8 @@ public static TSource SingleOrDefault(this IQueryable source, return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.SingleOrDefault_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, TSource?>(SingleOrDefault).Method, + source.Expression, Expression.Quote(predicate))); } /// 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. @@ -1458,7 +1339,6 @@ public static TSource SingleOrDefault(this IQueryable source, /// or is . /// More than one element satisfies the condition in . [DynamicDependency("SingleOrDefault`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource SingleOrDefault(this IQueryable source, Expression> predicate, TSource defaultValue) { ArgumentNullException.ThrowIfNull(source); @@ -1467,13 +1347,11 @@ public static TSource SingleOrDefault(this IQueryable source, return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.SingleOrDefault_TSource_4(typeof(TSource)), - source.Expression, Expression.Quote(predicate), Expression.Constant(defaultValue, typeof(TSource)) - )); + new Func, Expression>, TSource, TSource>(SingleOrDefault).Method, + source.Expression, Expression.Quote(predicate), Expression.Constant(defaultValue, typeof(TSource)))); } [DynamicDependency("ElementAt`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource ElementAt(this IQueryable source, int index) { ArgumentNullException.ThrowIfNull(source); @@ -1484,9 +1362,8 @@ public static TSource ElementAt(this IQueryable source, int in return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.ElementAt_Int32_TSource_2(typeof(TSource)), - source.Expression, Expression.Constant(index) - )); + new Func, int, TSource>(ElementAt).Method, + source.Expression, Expression.Constant(index))); } /// Returns the element at a specified index in a sequence. @@ -1497,7 +1374,6 @@ public static TSource ElementAt(this IQueryable source, int in /// is outside the bounds of the sequence. /// The element at the specified position in the sequence. [DynamicDependency("ElementAt`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource ElementAt(this IQueryable source, Index index) { ArgumentNullException.ThrowIfNull(source); @@ -1508,13 +1384,11 @@ public static TSource ElementAt(this IQueryable source, Index return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.ElementAt_Index_TSource_2(typeof(TSource)), - source.Expression, Expression.Constant(index) - )); + new Func, Index, TSource>(ElementAt).Method, + source.Expression, Expression.Constant(index))); } [DynamicDependency("ElementAtOrDefault`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? ElementAtOrDefault(this IQueryable source, int index) { ArgumentNullException.ThrowIfNull(source); @@ -1522,9 +1396,8 @@ public static TSource ElementAt(this IQueryable source, Index return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.ElementAtOrDefault_Int32_TSource_2(typeof(TSource)), - source.Expression, Expression.Constant(index) - )); + new Func, int, TSource?>(ElementAtOrDefault).Method, + source.Expression, Expression.Constant(index))); } /// Returns the element at a specified index in a sequence or a default value if the index is out of range. @@ -1534,7 +1407,6 @@ public static TSource ElementAt(this IQueryable source, Index /// is . /// if is outside the bounds of the sequence; otherwise, the element at the specified position in the sequence. [DynamicDependency("ElementAtOrDefault`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? ElementAtOrDefault(this IQueryable source, Index index) { ArgumentNullException.ThrowIfNull(source); @@ -1542,13 +1414,11 @@ public static TSource ElementAt(this IQueryable source, Index return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.ElementAtOrDefault_Index_TSource_2(typeof(TSource)), - source.Expression, Expression.Constant(index) - )); + new Func, Index, TSource?>(ElementAtOrDefault).Method, + source.Expression, Expression.Constant(index))); } [DynamicDependency("DefaultIfEmpty`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable DefaultIfEmpty(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -1556,11 +1426,11 @@ public static TSource ElementAt(this IQueryable source, Index return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.DefaultIfEmpty_TSource_1(typeof(TSource)), source.Expression)); + new Func, IQueryable>(DefaultIfEmpty).Method, + source.Expression)); } [DynamicDependency("DefaultIfEmpty`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable DefaultIfEmpty(this IQueryable source, TSource defaultValue) { ArgumentNullException.ThrowIfNull(source); @@ -1568,13 +1438,11 @@ public static IQueryable DefaultIfEmpty(this IQueryable( Expression.Call( null, - CachedReflectionInfo.DefaultIfEmpty_TSource_2(typeof(TSource)), - source.Expression, Expression.Constant(defaultValue, typeof(TSource)) - )); + new Func, TSource, IQueryable>(DefaultIfEmpty).Method, + source.Expression, Expression.Constant(defaultValue, typeof(TSource)))); } [DynamicDependency("Contains`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static bool Contains(this IQueryable source, TSource item) { ArgumentNullException.ThrowIfNull(source); @@ -1582,13 +1450,11 @@ public static bool Contains(this IQueryable source, TSource it return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Contains_TSource_2(typeof(TSource)), - source.Expression, Expression.Constant(item, typeof(TSource)) - )); + new Func, TSource, bool>(Contains).Method, + source.Expression, Expression.Constant(item, typeof(TSource)))); } [DynamicDependency("Contains`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static bool Contains(this IQueryable source, TSource item, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -1596,13 +1462,11 @@ public static bool Contains(this IQueryable source, TSource it return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Contains_TSource_3(typeof(TSource)), - source.Expression, Expression.Constant(item, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer)) - )); + new Func, TSource, IEqualityComparer, bool>(Contains).Method, + source.Expression, Expression.Constant(item, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer)))); } [DynamicDependency("Reverse`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Reverse(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -1610,11 +1474,11 @@ public static IQueryable Reverse(this IQueryable sour return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Reverse_TSource_1(typeof(TSource)), source.Expression)); + new Func, IQueryable>(Reverse).Method, + source.Expression)); } [DynamicDependency("SequenceEqual`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static bool SequenceEqual(this IQueryable source1, IEnumerable source2) { ArgumentNullException.ThrowIfNull(source1); @@ -1623,13 +1487,11 @@ public static bool SequenceEqual(this IQueryable source1, IEnu return source1.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.SequenceEqual_TSource_2(typeof(TSource)), - source1.Expression, GetSourceExpression(source2) - )); + new Func, IEnumerable, bool>(SequenceEqual).Method, + source1.Expression, GetSourceExpression(source2))); } [DynamicDependency("SequenceEqual`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static bool SequenceEqual(this IQueryable source1, IEnumerable source2, IEqualityComparer? comparer) { ArgumentNullException.ThrowIfNull(source1); @@ -1638,15 +1500,13 @@ public static bool SequenceEqual(this IQueryable source1, IEnu return source1.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.SequenceEqual_TSource_3(typeof(TSource)), + new Func, IEnumerable, IEqualityComparer, bool>(SequenceEqual).Method, source1.Expression, GetSourceExpression(source2), - Expression.Constant(comparer, typeof(IEqualityComparer)) - )); + Expression.Constant(comparer, typeof(IEqualityComparer)))); } [DynamicDependency("Any`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static bool Any(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -1654,11 +1514,11 @@ public static bool Any(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Any_TSource_1(typeof(TSource)), source.Expression)); + new Func, bool>(Any).Method, + source.Expression)); } [DynamicDependency("Any`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static bool Any(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -1667,13 +1527,11 @@ public static bool Any(this IQueryable source, Expression( Expression.Call( null, - CachedReflectionInfo.Any_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, bool>(Any).Method, + source.Expression, Expression.Quote(predicate))); } [DynamicDependency("All`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static bool All(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -1682,13 +1540,11 @@ public static bool All(this IQueryable source, Expression( Expression.Call( null, - CachedReflectionInfo.All_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, bool>(All).Method, + source.Expression, Expression.Quote(predicate))); } [DynamicDependency("Count`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static int Count(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -1696,11 +1552,11 @@ public static int Count(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Count_TSource_1(typeof(TSource)), source.Expression)); + new Func, int>(Count).Method, + source.Expression)); } [DynamicDependency("Count`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static int Count(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -1709,13 +1565,11 @@ public static int Count(this IQueryable source, Expression( Expression.Call( null, - CachedReflectionInfo.Count_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, int>(Count).Method, + source.Expression, Expression.Quote(predicate))); } [DynamicDependency("LongCount`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static long LongCount(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -1723,11 +1577,11 @@ public static long LongCount(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.LongCount_TSource_1(typeof(TSource)), source.Expression)); + new Func, long>(LongCount).Method, + source.Expression)); } [DynamicDependency("LongCount`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static long LongCount(this IQueryable source, Expression> predicate) { ArgumentNullException.ThrowIfNull(source); @@ -1736,13 +1590,11 @@ public static long LongCount(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.LongCount_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(predicate) - )); + new Func, Expression>, long>(LongCount).Method, + source.Expression, Expression.Quote(predicate))); } [DynamicDependency("Min`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? Min(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -1750,7 +1602,8 @@ public static long LongCount(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Min_TSource_1(typeof(TSource)), source.Expression)); + new Func, TSource?>(Min).Method, + source.Expression)); } /// Returns the minimum value in a generic . @@ -1761,7 +1614,6 @@ public static long LongCount(this IQueryable source, Expressio /// is . /// No object in implements the or interface. [DynamicDependency("Min`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? Min(this IQueryable source, IComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -1769,14 +1621,12 @@ public static long LongCount(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Min_TSource_2(typeof(TSource)), + new Func, IComparer, TSource?>(Min).Method, source.Expression, - Expression.Constant(comparer, typeof(IComparer)) - )); + Expression.Constant(comparer, typeof(IComparer)))); } [DynamicDependency("Min`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TResult? Min(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -1785,9 +1635,8 @@ public static long LongCount(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Min_TSource_TResult_2(typeof(TSource), typeof(TResult)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, TResult?>(Min).Method, + source.Expression, Expression.Quote(selector))); } /// Returns the minimum value in a generic according to a specified key selector function. @@ -1799,7 +1648,6 @@ public static long LongCount(this IQueryable source, Expressio /// is . /// No key extracted from implements the or interface. [DynamicDependency("MinBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? MinBy(this IQueryable source, Expression> keySelector) { ArgumentNullException.ThrowIfNull(source); @@ -1808,10 +1656,9 @@ public static long LongCount(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.MinBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), + new Func, Expression>, TSource?>(MinBy).Method, source.Expression, - Expression.Quote(keySelector) - )); + Expression.Quote(keySelector))); } /// Returns the minimum value in a generic according to a specified key selector function. @@ -1824,7 +1671,6 @@ public static long LongCount(this IQueryable source, Expressio /// is . /// No key extracted from implements the or interface. [DynamicDependency("MinBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? MinBy(this IQueryable source, Expression> keySelector, IComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -1833,15 +1679,13 @@ public static long LongCount(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.MinBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), + new Func, Expression>, IComparer, TSource?>(MinBy).Method, source.Expression, Expression.Quote(keySelector), - Expression.Constant(comparer, typeof(IComparer)) - )); + Expression.Constant(comparer, typeof(IComparer)))); } [DynamicDependency("Max`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? Max(this IQueryable source) { ArgumentNullException.ThrowIfNull(source); @@ -1849,7 +1693,8 @@ public static long LongCount(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Max_TSource_1(typeof(TSource)), source.Expression)); + new Func, TSource?>(Max).Method, + source.Expression)); } /// Returns the maximum value in a generic . @@ -1859,7 +1704,6 @@ public static long LongCount(this IQueryable source, Expressio /// The maximum value in the sequence. /// is . [DynamicDependency("Max`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? Max(this IQueryable source, IComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -1867,14 +1711,12 @@ public static long LongCount(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Max_TSource_2(typeof(TSource)), + new Func, IComparer, TSource?>(Max).Method, source.Expression, - Expression.Constant(comparer, typeof(IComparer)) - )); + Expression.Constant(comparer, typeof(IComparer)))); } [DynamicDependency("Max`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TResult? Max(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -1883,9 +1725,8 @@ public static long LongCount(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Max_TSource_TResult_2(typeof(TSource), typeof(TResult)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, TResult?>(Max).Method, + source.Expression, Expression.Quote(selector))); } /// Returns the maximum value in a generic according to a specified key selector function. @@ -1897,7 +1738,6 @@ public static long LongCount(this IQueryable source, Expressio /// is . /// No key extracted from implements the or interface. [DynamicDependency("MaxBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? MaxBy(this IQueryable source, Expression> keySelector) { ArgumentNullException.ThrowIfNull(source); @@ -1906,10 +1746,9 @@ public static long LongCount(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.MaxBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), + new Func, Expression>, TSource?>(MaxBy).Method, source.Expression, - Expression.Quote(keySelector) - )); + Expression.Quote(keySelector))); } /// Returns the maximum value in a generic according to a specified key selector function. @@ -1922,7 +1761,6 @@ public static long LongCount(this IQueryable source, Expressio /// is . /// No key extracted from implements the or interface. [DynamicDependency("MaxBy`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource? MaxBy(this IQueryable source, Expression> keySelector, IComparer? comparer) { ArgumentNullException.ThrowIfNull(source); @@ -1931,11 +1769,10 @@ public static long LongCount(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.MaxBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), + new Func, Expression>, IComparer, TSource?>(MaxBy).Method, source.Expression, Expression.Quote(keySelector), - Expression.Constant(comparer, typeof(IComparer)) - )); + Expression.Constant(comparer, typeof(IComparer)))); } [DynamicDependency("Sum", typeof(Enumerable))] @@ -1946,7 +1783,8 @@ public static int Sum(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Sum_Int32_1, source.Expression)); + new Func, int>(Sum).Method, + source.Expression)); } [DynamicDependency("Sum", typeof(Enumerable))] @@ -1957,7 +1795,8 @@ public static int Sum(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Sum_NullableInt32_1, source.Expression)); + new Func, int?>(Sum).Method, + source.Expression)); } [DynamicDependency("Sum", typeof(Enumerable))] @@ -1968,7 +1807,8 @@ public static long Sum(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Sum_Int64_1, source.Expression)); + new Func, long>(Sum).Method, + source.Expression)); } [DynamicDependency("Sum", typeof(Enumerable))] @@ -1979,7 +1819,8 @@ public static long Sum(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Sum_NullableInt64_1, source.Expression)); + new Func, long?>(Sum).Method, + source.Expression)); } [DynamicDependency("Sum", typeof(Enumerable))] @@ -1990,7 +1831,8 @@ public static float Sum(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Sum_Single_1, source.Expression)); + new Func, float>(Sum).Method, + source.Expression)); } [DynamicDependency("Sum", typeof(Enumerable))] @@ -2001,7 +1843,8 @@ public static float Sum(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Sum_NullableSingle_1, source.Expression)); + new Func, float?>(Sum).Method, + source.Expression)); } [DynamicDependency("Sum", typeof(Enumerable))] @@ -2012,7 +1855,8 @@ public static double Sum(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Sum_Double_1, source.Expression)); + new Func, double>(Sum).Method, + source.Expression)); } [DynamicDependency("Sum", typeof(Enumerable))] @@ -2023,7 +1867,8 @@ public static double Sum(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Sum_NullableDouble_1, source.Expression)); + new Func, double?>(Sum).Method, + source.Expression)); } [DynamicDependency("Sum", typeof(Enumerable))] @@ -2034,7 +1879,8 @@ public static decimal Sum(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Sum_Decimal_1, source.Expression)); + new Func, decimal>(Sum).Method, + source.Expression)); } [DynamicDependency("Sum", typeof(Enumerable))] @@ -2045,11 +1891,11 @@ public static decimal Sum(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Sum_NullableDecimal_1, source.Expression)); + new Func, decimal?>(Sum).Method, + source.Expression)); } [DynamicDependency("Sum`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static int Sum(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2058,13 +1904,11 @@ public static int Sum(this IQueryable source, Expression( Expression.Call( null, - CachedReflectionInfo.Sum_Int32_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, int>(Sum).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Sum`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static int? Sum(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2073,13 +1917,11 @@ public static int Sum(this IQueryable source, Expression( Expression.Call( null, - CachedReflectionInfo.Sum_NullableInt32_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, int?>(Sum).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Sum`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static long Sum(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2088,13 +1930,11 @@ public static long Sum(this IQueryable source, Expression( Expression.Call( null, - CachedReflectionInfo.Sum_Int64_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, long>(Sum).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Sum`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static long? Sum(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2103,13 +1943,11 @@ public static long Sum(this IQueryable source, Expression( Expression.Call( null, - CachedReflectionInfo.Sum_NullableInt64_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, long?>(Sum).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Sum`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static float Sum(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2118,13 +1956,11 @@ public static float Sum(this IQueryable source, Expression( Expression.Call( null, - CachedReflectionInfo.Sum_Single_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, float>(Sum).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Sum`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static float? Sum(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2133,13 +1969,11 @@ public static float Sum(this IQueryable source, Expression( Expression.Call( null, - CachedReflectionInfo.Sum_NullableSingle_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, float?>(Sum).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Sum`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static double Sum(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2148,13 +1982,11 @@ public static double Sum(this IQueryable source, Expression( Expression.Call( null, - CachedReflectionInfo.Sum_Double_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, double>(Sum).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Sum`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static double? Sum(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2163,13 +1995,11 @@ public static double Sum(this IQueryable source, Expression( Expression.Call( null, - CachedReflectionInfo.Sum_NullableDouble_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, double?>(Sum).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Sum`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static decimal Sum(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2178,13 +2008,11 @@ public static decimal Sum(this IQueryable source, Expression( Expression.Call( null, - CachedReflectionInfo.Sum_Decimal_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, decimal>(Sum).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Sum`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static decimal? Sum(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2193,9 +2021,8 @@ public static decimal Sum(this IQueryable source, Expression( Expression.Call( null, - CachedReflectionInfo.Sum_NullableDecimal_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, decimal?>(Sum).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Average", typeof(Enumerable))] @@ -2206,7 +2033,8 @@ public static double Average(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_Int32_1, source.Expression)); + new Func, double>(Average).Method, + source.Expression)); } [DynamicDependency("Average", typeof(Enumerable))] @@ -2217,7 +2045,8 @@ public static double Average(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_NullableInt32_1, source.Expression)); + new Func, double?>(Average).Method, + source.Expression)); } [DynamicDependency("Average", typeof(Enumerable))] @@ -2228,7 +2057,8 @@ public static double Average(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_Int64_1, source.Expression)); + new Func, double>(Average).Method, + source.Expression)); } [DynamicDependency("Average", typeof(Enumerable))] @@ -2239,7 +2069,8 @@ public static double Average(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_NullableInt64_1, source.Expression)); + new Func, double?>(Average).Method, + source.Expression)); } [DynamicDependency("Average", typeof(Enumerable))] @@ -2250,7 +2081,8 @@ public static float Average(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_Single_1, source.Expression)); + new Func, float>(Average).Method, + source.Expression)); } [DynamicDependency("Average", typeof(Enumerable))] @@ -2261,7 +2093,8 @@ public static float Average(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_NullableSingle_1, source.Expression)); + new Func, float?>(Average).Method, + source.Expression)); } [DynamicDependency("Average", typeof(Enumerable))] @@ -2272,7 +2105,8 @@ public static double Average(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_Double_1, source.Expression)); + new Func, double>(Average).Method, + source.Expression)); } [DynamicDependency("Average", typeof(Enumerable))] @@ -2283,7 +2117,8 @@ public static double Average(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_NullableDouble_1, source.Expression)); + new Func, double?>(Average).Method, + source.Expression)); } [DynamicDependency("Average", typeof(Enumerable))] @@ -2294,7 +2129,8 @@ public static decimal Average(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_Decimal_1, source.Expression)); + new Func, decimal>(Average).Method, + source.Expression)); } [DynamicDependency("Average", typeof(Enumerable))] @@ -2305,11 +2141,11 @@ public static decimal Average(this IQueryable source) return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_NullableDecimal_1, source.Expression)); + new Func, decimal?>(Average).Method, + source.Expression)); } [DynamicDependency("Average`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static double Average(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2318,13 +2154,11 @@ public static double Average(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_Int32_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, double>(Average).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Average`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static double? Average(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2333,13 +2167,11 @@ public static double Average(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_NullableInt32_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, double?>(Average).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Average`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static float Average(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2348,13 +2180,11 @@ public static float Average(this IQueryable source, Expression return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_Single_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, float>(Average).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Average`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static float? Average(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2363,13 +2193,11 @@ public static float Average(this IQueryable source, Expression return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_NullableSingle_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, float?>(Average).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Average`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static double Average(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2378,13 +2206,11 @@ public static double Average(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_Int64_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, double>(Average).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Average`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static double? Average(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2393,13 +2219,11 @@ public static double Average(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_NullableInt64_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, double?>(Average).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Average`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static double Average(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2408,13 +2232,11 @@ public static double Average(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_Double_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, double>(Average).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Average`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static double? Average(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2423,13 +2245,11 @@ public static double Average(this IQueryable source, Expressio return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_NullableDouble_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, double?>(Average).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Average`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static decimal Average(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2438,13 +2258,11 @@ public static decimal Average(this IQueryable source, Expressi return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_Decimal_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, decimal>(Average).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Average`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static decimal? Average(this IQueryable source, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2453,13 +2271,11 @@ public static decimal Average(this IQueryable source, Expressi return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Average_NullableDecimal_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(selector) - )); + new Func, Expression>, decimal?>(Average).Method, + source.Expression, Expression.Quote(selector))); } [DynamicDependency("Aggregate`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TSource Aggregate(this IQueryable source, Expression> func) { ArgumentNullException.ThrowIfNull(source); @@ -2468,13 +2284,11 @@ public static TSource Aggregate(this IQueryable source, Expres return source.Provider.Execute( Expression.Call( null, - CachedReflectionInfo.Aggregate_TSource_2(typeof(TSource)), - source.Expression, Expression.Quote(func) - )); + new Func, Expression>, TSource>(Aggregate).Method, + source.Expression, Expression.Quote(func))); } [DynamicDependency("Aggregate`2", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TAccumulate Aggregate(this IQueryable source, TAccumulate seed, Expression> func) { ArgumentNullException.ThrowIfNull(source); @@ -2483,13 +2297,11 @@ public static TAccumulate Aggregate(this IQueryable( Expression.Call( null, - CachedReflectionInfo.Aggregate_TSource_TAccumulate_3(typeof(TSource), typeof(TAccumulate)), - source.Expression, Expression.Constant(seed), Expression.Quote(func) - )); + new Func, TAccumulate, Expression>, TAccumulate>(Aggregate).Method, + source.Expression, Expression.Constant(seed), Expression.Quote(func))); } [DynamicDependency("Aggregate`3", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static TResult Aggregate(this IQueryable source, TAccumulate seed, Expression> func, Expression> selector) { ArgumentNullException.ThrowIfNull(source); @@ -2499,11 +2311,11 @@ public static TResult Aggregate(this IQueryable( Expression.Call( null, - CachedReflectionInfo.Aggregate_TSource_TAccumulate_TResult_4(typeof(TSource), typeof(TAccumulate), typeof(TResult)), source.Expression, Expression.Constant(seed), Expression.Quote(func), Expression.Quote(selector))); + new Func, TAccumulate, Expression>, Expression>, TResult>(Aggregate).Method, + source.Expression, Expression.Constant(seed), Expression.Quote(func), Expression.Quote(selector))); } [DynamicDependency("SkipLast`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable SkipLast(this IQueryable source, int count) { ArgumentNullException.ThrowIfNull(source); @@ -2511,13 +2323,12 @@ public static IQueryable SkipLast(this IQueryable sou return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.SkipLast_TSource_2(typeof(TSource)), + new Func, int, IQueryable>(SkipLast).Method, source.Expression, Expression.Constant(count) )); } [DynamicDependency("TakeLast`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable TakeLast(this IQueryable source, int count) { ArgumentNullException.ThrowIfNull(source); @@ -2525,13 +2336,11 @@ public static IQueryable TakeLast(this IQueryable sou return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.TakeLast_TSource_2(typeof(TSource)), - source.Expression, Expression.Constant(count) - )); + new Func, int, IQueryable>(TakeLast).Method, + source.Expression, Expression.Constant(count))); } [DynamicDependency("Append`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Append(this IQueryable source, TSource element) { ArgumentNullException.ThrowIfNull(source); @@ -2539,13 +2348,11 @@ public static IQueryable Append(this IQueryable sourc return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Append_TSource_2(typeof(TSource)), - source.Expression, Expression.Constant(element) - )); + new Func, TSource, IQueryable>(Append).Method, + source.Expression, Expression.Constant(element))); } [DynamicDependency("Prepend`1", typeof(Enumerable))] - [RequiresDynamicCode(InMemoryQueryableExtensionMethodsRequiresDynamicCode)] public static IQueryable Prepend(this IQueryable source, TSource element) { ArgumentNullException.ThrowIfNull(source); @@ -2553,9 +2360,8 @@ public static IQueryable Prepend(this IQueryable sour return source.Provider.CreateQuery( Expression.Call( null, - CachedReflectionInfo.Prepend_TSource_2(typeof(TSource)), - source.Expression, Expression.Constant(element) - )); + new Func, TSource, IQueryable>(Prepend).Method, + source.Expression, Expression.Constant(element))); } } } diff --git a/src/libraries/System.Linq.Queryable/tests/AggregateTests.cs b/src/libraries/System.Linq.Queryable/tests/AggregateTests.cs index 86e2ac8579bf9..59885eb9bcddd 100644 --- a/src/libraries/System.Linq.Queryable/tests/AggregateTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/AggregateTests.cs @@ -64,21 +64,21 @@ public void NullResultSelector() [Fact] public void Aggregate1() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Aggregate((n1, n2) => n1 + n2); + var val = new[] { 0, 2, 1 }.AsQueryable().Aggregate((n1, n2) => n1 + n2); Assert.Equal((int)3, val); } [Fact] public void Aggregate2() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Aggregate("", (n1, n2) => n1 + n2.ToString()); + var val = new[] { 0, 2, 1 }.AsQueryable().Aggregate("", (n1, n2) => n1 + n2.ToString()); Assert.Equal("021", val); } [Fact] public void Aggregate3() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Aggregate(0L, (n1, n2) => n1 + n2, n => n.ToString()); + var val = new[] { 0, 2, 1 }.AsQueryable().Aggregate(0L, (n1, n2) => n1 + n2, n => n.ToString()); Assert.Equal("3", val); } } diff --git a/src/libraries/System.Linq.Queryable/tests/AllTests.cs b/src/libraries/System.Linq.Queryable/tests/AllTests.cs index 137142d510a1e..a9902428a1f99 100644 --- a/src/libraries/System.Linq.Queryable/tests/AllTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/AllTests.cs @@ -32,7 +32,7 @@ public void NullPredicateUsed() [Fact] public void All() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().All(n => n > 1); + var val = new[] { 0, 2, 1 }.AsQueryable().All(n => n > 1); Assert.False(val); } } diff --git a/src/libraries/System.Linq.Queryable/tests/AnyTests.cs b/src/libraries/System.Linq.Queryable/tests/AnyTests.cs index e218d53908b62..3d7555591380f 100644 --- a/src/libraries/System.Linq.Queryable/tests/AnyTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/AnyTests.cs @@ -55,14 +55,14 @@ public void NullPredicateUsed() [Fact] public void Any1() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Any(); + var val = new[] { 0, 2, 1 }.AsQueryable().Any(); Assert.True(val); } [Fact] public void Any2() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Any(n => n > 1); + var val = new[] { 0, 2, 1 }.AsQueryable().Any(n => n > 1); Assert.True(val); } } diff --git a/src/libraries/System.Linq.Queryable/tests/AverageTests.cs b/src/libraries/System.Linq.Queryable/tests/AverageTests.cs index 668e4c9aa3b31..39055e4c21db0 100644 --- a/src/libraries/System.Linq.Queryable/tests/AverageTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/AverageTests.cs @@ -432,140 +432,140 @@ public void MultipleFloatFromSelector() [Fact] public void Average1() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Average(); + var val = new[] { 0, 2, 1 }.AsQueryable().Average(); Assert.Equal((double)1, val); } [Fact] public void Average2() { - var val = (new int?[] { 0, 2, 1 }).AsQueryable().Average(); + var val = new int?[] { 0, 2, 1 }.AsQueryable().Average(); Assert.Equal((double)1, val); } [Fact] public void Average3() { - var val = (new long[] { 0, 2, 1 }).AsQueryable().Average(); + var val = new long[] { 0, 2, 1 }.AsQueryable().Average(); Assert.Equal((double)1, val); } [Fact] public void Average4() { - var val = (new long?[] { 0, 2, 1 }).AsQueryable().Average(); + var val = new long?[] { 0, 2, 1 }.AsQueryable().Average(); Assert.Equal((double)1, val); } [Fact] public void Average5() { - var val = (new float[] { 0, 2, 1 }).AsQueryable().Average(); + var val = new float[] { 0, 2, 1 }.AsQueryable().Average(); Assert.Equal((float)1, val); } [Fact] public void Average6() { - var val = (new float?[] { 0, 2, 1 }).AsQueryable().Average(); + var val = new float?[] { 0, 2, 1 }.AsQueryable().Average(); Assert.Equal((float)1, val); } [Fact] public void Average7() { - var val = (new double[] { 0, 2, 1 }).AsQueryable().Average(); + var val = new double[] { 0, 2, 1 }.AsQueryable().Average(); Assert.Equal((double)1, val); } [Fact] public void Average8() { - var val = (new double?[] { 0, 2, 1 }).AsQueryable().Average(); + var val = new double?[] { 0, 2, 1 }.AsQueryable().Average(); Assert.Equal((double)1, val); } [Fact] public void Average9() { - var val = (new decimal[] { 0, 2, 1 }).AsQueryable().Average(); + var val = new decimal[] { 0, 2, 1 }.AsQueryable().Average(); Assert.Equal((decimal)1, val); } [Fact] public void Average10() { - var val = (new decimal?[] { 0, 2, 1 }).AsQueryable().Average(); + var val = new decimal?[] { 0, 2, 1 }.AsQueryable().Average(); Assert.Equal((decimal)1, val); } [Fact] public void Average11() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Average(n => n); + var val = new[] { 0, 2, 1 }.AsQueryable().Average(n => n); Assert.Equal((double)1, val); } [Fact] public void Average12() { - var val = (new int?[] { 0, 2, 1 }).AsQueryable().Average(n => n); + var val = new int?[] { 0, 2, 1 }.AsQueryable().Average(n => n); Assert.Equal((double)1, val); } [Fact] public void Average13() { - var val = (new long[] { 0, 2, 1 }).AsQueryable().Average(n => n); + var val = new long[] { 0, 2, 1 }.AsQueryable().Average(n => n); Assert.Equal((double)1, val); } [Fact] public void Average14() { - var val = (new long?[] { 0, 2, 1 }).AsQueryable().Average(n => n); + var val = new long?[] { 0, 2, 1 }.AsQueryable().Average(n => n); Assert.Equal((double)1, val); } [Fact] public void Average15() { - var val = (new float[] { 0, 2, 1 }).AsQueryable().Average(n => n); + var val = new float[] { 0, 2, 1 }.AsQueryable().Average(n => n); Assert.Equal((float)1, val); } [Fact] public void Average16() { - var val = (new float?[] { 0, 2, 1 }).AsQueryable().Average(n => n); + var val = new float?[] { 0, 2, 1 }.AsQueryable().Average(n => n); Assert.Equal((float)1, val); } [Fact] public void Average17() { - var val = (new double[] { 0, 2, 1 }).AsQueryable().Average(n => n); + var val = new double[] { 0, 2, 1 }.AsQueryable().Average(n => n); Assert.Equal((double)1, val); } [Fact] public void Average18() { - var val = (new double?[] { 0, 2, 1 }).AsQueryable().Average(n => n); + var val = new double?[] { 0, 2, 1 }.AsQueryable().Average(n => n); Assert.Equal((double)1, val); } [Fact] public void Average19() { - var val = (new decimal[] { 0, 2, 1 }).AsQueryable().Average(n => n); + var val = new decimal[] { 0, 2, 1 }.AsQueryable().Average(n => n); Assert.Equal((decimal)1, val); } [Fact] public void Average20() { - var val = (new decimal?[] { 0, 2, 1 }).AsQueryable().Average(n => n); + var val = new decimal?[] { 0, 2, 1 }.AsQueryable().Average(n => n); Assert.Equal((decimal)1, val); } } diff --git a/src/libraries/System.Linq.Queryable/tests/CastTests.cs b/src/libraries/System.Linq.Queryable/tests/CastTests.cs index de500ec40126e..52539d099afb3 100644 --- a/src/libraries/System.Linq.Queryable/tests/CastTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/CastTests.cs @@ -92,7 +92,7 @@ public void ThrowOnUncastableItem() [Fact] public void ThrowCastingIntToDouble() { - int[] source = new int[] { -4, 1, 2, 9 }; + int[] source = { -4, 1, 2, 9 }; IQueryable cast = source.AsQueryable().Cast(); Assert.Throws(() => cast.ToList()); @@ -159,7 +159,7 @@ public void NullableIntFromNullsAndInts() [Fact] public void ThrowCastingIntToLong() { - int[] source = new int[] { -4, 1, 2, 3, 9 }; + int[] source = { -4, 1, 2, 3, 9 }; IQueryable cast = source.AsQueryable().Cast(); Assert.Throws(() => cast.ToList()); @@ -168,7 +168,7 @@ public void ThrowCastingIntToLong() [Fact] public void ThrowCastingIntToNullableLong() { - int[] source = new int[] { -4, 1, 2, 3, 9 }; + int[] source = { -4, 1, 2, 3, 9 }; IQueryable cast = source.AsQueryable().Cast(); Assert.Throws(() => cast.ToList()); @@ -177,7 +177,7 @@ public void ThrowCastingIntToNullableLong() [Fact] public void ThrowCastingNullableIntToLong() { - int?[] source = new int?[] { -4, 1, 2, 3, 9 }; + int?[] source = { -4, 1, 2, 3, 9 }; IQueryable cast = source.AsQueryable().Cast(); Assert.Throws(() => cast.ToList()); @@ -186,7 +186,7 @@ public void ThrowCastingNullableIntToLong() [Fact] public void ThrowCastingNullableIntToNullableLong() { - int?[] source = new int?[] { -4, 1, 2, 3, 9, null }; + int?[] source = { -4, 1, 2, 3, 9, null }; IQueryable cast = source.AsQueryable().Cast(); Assert.Throws(() => cast.ToList()); @@ -195,7 +195,7 @@ public void ThrowCastingNullableIntToNullableLong() [Fact] public void CastingNullToNonnullableIsNullReferenceException() { - int?[] source = new int?[] { -4, 1, null, 3 }; + int?[] source = { -4, 1, null, 3 }; IQueryable cast = source.AsQueryable().Cast(); Assert.Throws(() => cast.ToList()); } @@ -209,7 +209,7 @@ public void NullSource() [Fact] public void Cast() { - var count = (new object[] { 0, 1, 2 }).AsQueryable().Cast().Count(); + var count = new object[] { 0, 1, 2 }.AsQueryable().Cast().Count(); Assert.Equal(3, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/ConcatTests.cs b/src/libraries/System.Linq.Queryable/tests/ConcatTests.cs index 90cb45f7045cb..d04195aafdc12 100644 --- a/src/libraries/System.Linq.Queryable/tests/ConcatTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/ConcatTests.cs @@ -40,7 +40,7 @@ public void SecondNull() [Fact] public void Concat() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Concat((new int[] { 10, 11, 12 }).AsQueryable()).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Concat(new[] { 10, 11, 12 }.AsQueryable()).Count(); Assert.Equal(6, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/ContainsTests.cs b/src/libraries/System.Linq.Queryable/tests/ContainsTests.cs index b1f2561710ce6..9581b8edc4b7d 100644 --- a/src/libraries/System.Linq.Queryable/tests/ContainsTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/ContainsTests.cs @@ -62,14 +62,14 @@ public void NullSource() [Fact] public void Contains1() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Contains(1); + var val = new[] { 0, 2, 1 }.AsQueryable().Contains(1); Assert.True(val); } [Fact] public void Contains2() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Contains(1, EqualityComparer.Default); + var val = new[] { 0, 2, 1 }.AsQueryable().Contains(1, EqualityComparer.Default); Assert.True(val); } } diff --git a/src/libraries/System.Linq.Queryable/tests/CountTests.cs b/src/libraries/System.Linq.Queryable/tests/CountTests.cs index 9d564a61e7c8c..5123ec6cacc09 100644 --- a/src/libraries/System.Linq.Queryable/tests/CountTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/CountTests.cs @@ -56,14 +56,14 @@ public void NullPredicateUsed() [Fact] public void Count1() { - var count = (new int[] { 0 }).AsQueryable().Count(); + var count = new[] { 0 }.AsQueryable().Count(); Assert.Equal(1, count); } [Fact] public void Count2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Count(n => n > 0); + var count = new[] { 0, 1, 2 }.AsQueryable().Count(n => n > 0); Assert.Equal(2, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/DefaultIfEmptyTests.cs b/src/libraries/System.Linq.Queryable/tests/DefaultIfEmptyTests.cs index 30c79f2db0240..aa6f269d4b521 100644 --- a/src/libraries/System.Linq.Queryable/tests/DefaultIfEmptyTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/DefaultIfEmptyTests.cs @@ -65,14 +65,14 @@ public void NullSource() [Fact] public void DefaultIfEmpty1() { - var count = (new int[] { }).AsQueryable().DefaultIfEmpty().Count(); + var count = new int[] { }.AsQueryable().DefaultIfEmpty().Count(); Assert.Equal(1, count); } [Fact] public void DefaultIfEmpty2() { - var count = (new int[] { }).AsQueryable().DefaultIfEmpty(3).Count(); + var count = new int[] { }.AsQueryable().DefaultIfEmpty(3).Count(); Assert.Equal(1, count); } diff --git a/src/libraries/System.Linq.Queryable/tests/DistinctTests.cs b/src/libraries/System.Linq.Queryable/tests/DistinctTests.cs index 4445690199032..fa8a0b18fd311 100644 --- a/src/libraries/System.Linq.Queryable/tests/DistinctTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/DistinctTests.cs @@ -68,14 +68,14 @@ public void NullSourceCustomComparer() [Fact] public void Distinct1() { - var count = (new int[] { 0, 1, 2, 2, 0 }).AsQueryable().Distinct().Count(); + var count = new[] { 0, 1, 2, 2, 0 }.AsQueryable().Distinct().Count(); Assert.Equal(3, count); } [Fact] public void Distinct2() { - var count = (new int[] { 0, 1, 2, 2, 0 }).AsQueryable().Distinct(EqualityComparer.Default).Count(); + var count = new[] { 0, 1, 2, 2, 0 }.AsQueryable().Distinct(EqualityComparer.Default).Count(); Assert.Equal(3, count); } diff --git a/src/libraries/System.Linq.Queryable/tests/EnumerableQueryTests.cs b/src/libraries/System.Linq.Queryable/tests/EnumerableQueryTests.cs index 8a02695d50f5b..60d50269bd6ab 100644 --- a/src/libraries/System.Linq.Queryable/tests/EnumerableQueryTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/EnumerableQueryTests.cs @@ -39,7 +39,7 @@ public void InappropriateExpressionType() public void WrapsEnumerableInExpression() { int[] source = { 1, 2, 3 }; - IQueryable query = (source).AsQueryable(); + IQueryable query = source.AsQueryable(); var exp = (ConstantExpression)query.Expression; Assert.Equal(source, (IEnumerable)exp.Value); } diff --git a/src/libraries/System.Linq.Queryable/tests/ExceptTests.cs b/src/libraries/System.Linq.Queryable/tests/ExceptTests.cs index 7ccd478d1b29f..80ce55f680739 100644 --- a/src/libraries/System.Linq.Queryable/tests/ExceptTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/ExceptTests.cs @@ -76,14 +76,14 @@ public void SecondNullNoComparer() [Fact] public void Except1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Except((new int[] { 1, 2, 3 }).AsQueryable()).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Except(new[] { 1, 2, 3 }.AsQueryable()).Count(); Assert.Equal(1, count); } [Fact] public void Except2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Except((new int[] { 1, 2, 3 }).AsQueryable(), EqualityComparer.Default).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Except(new[] { 1, 2, 3 }.AsQueryable(), EqualityComparer.Default).Count(); Assert.Equal(1, count); } diff --git a/src/libraries/System.Linq.Queryable/tests/FirstOrDefaultTests.cs b/src/libraries/System.Linq.Queryable/tests/FirstOrDefaultTests.cs index 9d655177ef92d..d98c27af89f65 100644 --- a/src/libraries/System.Linq.Queryable/tests/FirstOrDefaultTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/FirstOrDefaultTests.cs @@ -119,14 +119,14 @@ public void NullPredicate() [Fact] public void FirstOrDefault1() { - var val = (new int[] { 1, 2 }).AsQueryable().FirstOrDefault(); + var val = new[] { 1, 2 }.AsQueryable().FirstOrDefault(); Assert.Equal(1, val); } [Fact] public void FirstOrDefault2() { - var val = (new int[] { 0, 1, 2 }).AsQueryable().FirstOrDefault(n => n > 1); + var val = new[] { 0, 1, 2 }.AsQueryable().FirstOrDefault(n => n > 1); Assert.Equal(2, val); } diff --git a/src/libraries/System.Linq.Queryable/tests/FirstTests.cs b/src/libraries/System.Linq.Queryable/tests/FirstTests.cs index 906c87f64b0e0..6996329192737 100644 --- a/src/libraries/System.Linq.Queryable/tests/FirstTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/FirstTests.cs @@ -72,14 +72,14 @@ public void NullPredicate() [Fact] public void First1() { - var val = (new int[] { 1, 2 }).AsQueryable().First(); + var val = new[] { 1, 2 }.AsQueryable().First(); Assert.Equal(1, val); } [Fact] public void First2() { - var val = (new int[] { 0, 1, 2 }).AsQueryable().First(n => n > 1); + var val = new[] { 0, 1, 2 }.AsQueryable().First(n => n > 1); Assert.Equal(2, val); } } diff --git a/src/libraries/System.Linq.Queryable/tests/GroupByTests.cs b/src/libraries/System.Linq.Queryable/tests/GroupByTests.cs index 004b2d65e8883..24f90a355b7f9 100644 --- a/src/libraries/System.Linq.Queryable/tests/GroupByTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/GroupByTests.cs @@ -111,8 +111,7 @@ public void SourceIsNull() [Fact] public void KeySelectorNull() { - Record[] source = new[] - { + Record[] source = { new Record { Name = "Tim", Score = 55 }, new Record { Name = "Chris", Score = 49 }, new Record { Name = "Robert", Score = -100 }, @@ -136,8 +135,7 @@ public void KeySelectorNull() [Fact] public void ElementSelectorNull() { - Record[] source = new[] - { + Record[] source = { new Record { Name = "Tim", Score = 55 }, new Record { Name = "Chris", Score = 49 }, new Record { Name = "Robert", Score = -100 }, @@ -313,56 +311,56 @@ public void NullComparerResultSelectorUsed() [Fact] public void GroupBy1() { - var count = (new int[] { 0, 1, 2, 2, 0 }).AsQueryable().GroupBy(n => n).Count(); + var count = new[] { 0, 1, 2, 2, 0 }.AsQueryable().GroupBy(n => n).Count(); Assert.Equal(3, count); } [Fact] public void GroupBy2() { - var count = (new int[] { 0, 1, 2, 2, 0 }).AsQueryable().GroupBy(n => n, EqualityComparer.Default).Count(); + var count = new[] { 0, 1, 2, 2, 0 }.AsQueryable().GroupBy(n => n, EqualityComparer.Default).Count(); Assert.Equal(3, count); } [Fact] public void GroupBy3() { - var count = (new int[] { 0, 1, 2, 2, 0 }).AsQueryable().GroupBy(n => n, n => n).Count(); + var count = new[] { 0, 1, 2, 2, 0 }.AsQueryable().GroupBy(n => n, n => n).Count(); Assert.Equal(3, count); } [Fact] public void GroupBy4() { - var count = (new int[] { 0, 1, 2, 2, 0 }).AsQueryable().GroupBy(n => n, n => n, EqualityComparer.Default).Count(); + var count = new[] { 0, 1, 2, 2, 0 }.AsQueryable().GroupBy(n => n, n => n, EqualityComparer.Default).Count(); Assert.Equal(3, count); } [Fact] public void GroupBy5() { - var count = (new int[] { 0, 1, 2, 2, 0 }).AsQueryable().GroupBy(n => n, n => n, (k, g) => k).Count(); + var count = new[] { 0, 1, 2, 2, 0 }.AsQueryable().GroupBy(n => n, n => n, (k, g) => k).Count(); Assert.Equal(3, count); } [Fact] public void GroupBy6() { - var count = (new int[] { 0, 1, 2, 2, 0 }).AsQueryable().GroupBy(n => n, (k, g) => k).Count(); + var count = new[] { 0, 1, 2, 2, 0 }.AsQueryable().GroupBy(n => n, (k, g) => k).Count(); Assert.Equal(3, count); } [Fact] public void GroupBy7() { - var count = (new int[] { 0, 1, 2, 2, 0 }).AsQueryable().GroupBy(n => n, n => n, (k, g) => k, EqualityComparer.Default).Count(); + var count = new[] { 0, 1, 2, 2, 0 }.AsQueryable().GroupBy(n => n, n => n, (k, g) => k, EqualityComparer.Default).Count(); Assert.Equal(3, count); } [Fact] public void GroupBy8() { - var count = (new int[] { 0, 1, 2, 2, 0 }).AsQueryable().GroupBy(n => n, (k, g) => k, EqualityComparer.Default).Count(); + var count = new[] { 0, 1, 2, 2, 0 }.AsQueryable().GroupBy(n => n, (k, g) => k, EqualityComparer.Default).Count(); Assert.Equal(3, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/GroupJoinTests.cs b/src/libraries/System.Linq.Queryable/tests/GroupJoinTests.cs index dbaa56fe11c94..3db5cb8cad203 100644 --- a/src/libraries/System.Linq.Queryable/tests/GroupJoinTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/GroupJoinTests.cs @@ -79,8 +79,7 @@ public override bool Equals(object obj) public void OuterEmptyInnerNonEmpty() { CustomerRec[] outer = { }; - OrderRec[] inner = new [] - { + OrderRec[] inner = { new OrderRec{ orderID = 45321, custID = 98022, total = 50 }, new OrderRec{ orderID = 97865, custID = 32103, total = 25 } }; @@ -90,19 +89,16 @@ public void OuterEmptyInnerNonEmpty() [Fact] public void CustomComparer() { - CustomerRec[] outer = new [] - { + CustomerRec[] outer = { new CustomerRec{ name = "Tim", custID = 1234 }, new CustomerRec{ name = "Bob", custID = 9865 }, new CustomerRec{ name = "Robert", custID = 9895 } }; - AnagramRec[] inner = new [] - { + AnagramRec[] inner = { new AnagramRec{ name = "Robert", orderID = 93483, total = 19 }, new AnagramRec{ name = "miT", orderID = 93489, total = 45 } }; - JoinRec[] expected = new [] - { + JoinRec[] expected = { new JoinRec{ name = "Tim", orderID = new int?[]{ 93489 }, total = new int?[]{ 45 } }, new JoinRec{ name = "Bob", orderID = new int?[]{ }, total = new int?[]{ } }, new JoinRec{ name = "Robert", orderID = new int?[]{ 93483 }, total = new int?[]{ 19 } } @@ -115,8 +111,7 @@ public void CustomComparer() public void OuterNull() { IQueryable outer = null; - AnagramRec[] inner = new AnagramRec[] - { + AnagramRec[] inner = { new AnagramRec{ name = "Robert", orderID = 93483, total = 19 }, new AnagramRec{ name = "miT", orderID = 93489, total = 45 } }; @@ -127,8 +122,7 @@ public void OuterNull() [Fact] public void InnerNull() { - CustomerRec[] outer = new [] - { + CustomerRec[] outer = { new CustomerRec{ name = "Tim", custID = 1234 }, new CustomerRec{ name = "Bob", custID = 9865 }, new CustomerRec{ name = "Robert", custID = 9895 } @@ -141,14 +135,12 @@ public void InnerNull() [Fact] public void OuterKeySelectorNull() { - CustomerRec[] outer = new CustomerRec[] - { + CustomerRec[] outer = { new CustomerRec{ name = "Tim", custID = 1234 }, new CustomerRec{ name = "Bob", custID = 9865 }, new CustomerRec{ name = "Robert", custID = 9895 } }; - AnagramRec[] inner = new AnagramRec[] - { + AnagramRec[] inner = { new AnagramRec{ name = "Robert", orderID = 93483, total = 19 }, new AnagramRec{ name = "miT", orderID = 93489, total = 45 } }; @@ -159,14 +151,12 @@ public void OuterKeySelectorNull() [Fact] public void InnerKeySelectorNull() { - CustomerRec[] outer = new CustomerRec[] - { + CustomerRec[] outer = { new CustomerRec{ name = "Tim", custID = 1234 }, new CustomerRec{ name = "Bob", custID = 9865 }, new CustomerRec{ name = "Robert", custID = 9895 } }; - AnagramRec[] inner = new AnagramRec[] - { + AnagramRec[] inner = { new AnagramRec{ name = "Robert", orderID = 93483, total = 19 }, new AnagramRec{ name = "miT", orderID = 93489, total = 45 } }; @@ -177,14 +167,12 @@ public void InnerKeySelectorNull() [Fact] public void ResultSelectorNull() { - CustomerRec[] outer = new CustomerRec[] - { + CustomerRec[] outer = { new CustomerRec{ name = "Tim", custID = 1234 }, new CustomerRec{ name = "Bob", custID = 9865 }, new CustomerRec{ name = "Robert", custID = 9895 } }; - AnagramRec[] inner = new AnagramRec[] - { + AnagramRec[] inner = { new AnagramRec{ name = "Robert", orderID = 93483, total = 19 }, new AnagramRec{ name = "miT", orderID = 93489, total = 45 } }; @@ -196,8 +184,7 @@ public void ResultSelectorNull() public void OuterNullNoComparer() { IQueryable outer = null; - AnagramRec[] inner = new AnagramRec[] - { + AnagramRec[] inner = { new AnagramRec{ name = "Robert", orderID = 93483, total = 19 }, new AnagramRec{ name = "miT", orderID = 93489, total = 45 } }; @@ -208,8 +195,7 @@ public void OuterNullNoComparer() [Fact] public void InnerNullNoComparer() { - CustomerRec[] outer = new[] - { + CustomerRec[] outer = { new CustomerRec{ name = "Tim", custID = 1234 }, new CustomerRec{ name = "Bob", custID = 9865 }, new CustomerRec{ name = "Robert", custID = 9895 } @@ -222,14 +208,12 @@ public void InnerNullNoComparer() [Fact] public void OuterKeySelectorNullNoComparer() { - CustomerRec[] outer = new CustomerRec[] - { + CustomerRec[] outer = { new CustomerRec{ name = "Tim", custID = 1234 }, new CustomerRec{ name = "Bob", custID = 9865 }, new CustomerRec{ name = "Robert", custID = 9895 } }; - AnagramRec[] inner = new AnagramRec[] - { + AnagramRec[] inner = { new AnagramRec{ name = "Robert", orderID = 93483, total = 19 }, new AnagramRec{ name = "miT", orderID = 93489, total = 45 } }; @@ -240,14 +224,12 @@ public void OuterKeySelectorNullNoComparer() [Fact] public void InnerKeySelectorNullNoComparer() { - CustomerRec[] outer = new CustomerRec[] - { + CustomerRec[] outer = { new CustomerRec{ name = "Tim", custID = 1234 }, new CustomerRec{ name = "Bob", custID = 9865 }, new CustomerRec{ name = "Robert", custID = 9895 } }; - AnagramRec[] inner = new AnagramRec[] - { + AnagramRec[] inner = { new AnagramRec{ name = "Robert", orderID = 93483, total = 19 }, new AnagramRec{ name = "miT", orderID = 93489, total = 45 } }; @@ -258,14 +240,12 @@ public void InnerKeySelectorNullNoComparer() [Fact] public void ResultSelectorNullNoComparer() { - CustomerRec[] outer = new CustomerRec[] - { + CustomerRec[] outer = { new CustomerRec{ name = "Tim", custID = 1234 }, new CustomerRec{ name = "Bob", custID = 9865 }, new CustomerRec{ name = "Robert", custID = 9895 } }; - AnagramRec[] inner = new AnagramRec[] - { + AnagramRec[] inner = { new AnagramRec{ name = "Robert", orderID = 93483, total = 19 }, new AnagramRec{ name = "miT", orderID = 93489, total = 45 } }; @@ -276,19 +256,16 @@ public void ResultSelectorNullNoComparer() [Fact] public void NullComparer() { - CustomerRec[] outer = new [] - { + CustomerRec[] outer = { new CustomerRec{ name = "Tim", custID = 1234 }, new CustomerRec{ name = "Bob", custID = 9865 }, new CustomerRec{ name = "Robert", custID = 9895 } }; - AnagramRec[] inner = new [] - { + AnagramRec[] inner = { new AnagramRec{ name = "Robert", orderID = 93483, total = 19 }, new AnagramRec{ name = "miT", orderID = 93489, total = 45 } }; - JoinRec[] expected = new [] - { + JoinRec[] expected = { new JoinRec{ name = "Tim", orderID = new int?[]{ }, total = new int?[]{ } }, new JoinRec{ name = "Bob", orderID = new int?[]{ }, total = new int?[]{ } }, new JoinRec{ name = "Robert", orderID = new int?[]{ 93483 }, total = new int?[]{ 19 } } @@ -300,14 +277,14 @@ public void NullComparer() [Fact] public void GroupJoin1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().GroupJoin(new int[] { 1, 2, 3 }, n1 => n1, n2 => n2, (n1, n2) => n1).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().GroupJoin(new[] { 1, 2, 3 }, n1 => n1, n2 => n2, (n1, n2) => n1).Count(); Assert.Equal(3, count); } [Fact] public void GroupJoin2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().GroupJoin(new int[] { 1, 2, 3 }, n1 => n1, n2 => n2, (n1, n2) => n1, EqualityComparer.Default).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().GroupJoin(new[] { 1, 2, 3 }, n1 => n1, n2 => n2, (n1, n2) => n1, EqualityComparer.Default).Count(); Assert.Equal(3, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/IntersectTests.cs b/src/libraries/System.Linq.Queryable/tests/IntersectTests.cs index 184a618f64ef3..186a30735726f 100644 --- a/src/libraries/System.Linq.Queryable/tests/IntersectTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/IntersectTests.cs @@ -74,14 +74,14 @@ public void CustomComparer() [Fact] public void Intersect1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Intersect((new int[] { 1, 2, 3 }).AsQueryable()).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Intersect(new[] { 1, 2, 3 }.AsQueryable()).Count(); Assert.Equal(2, count); } [Fact] public void Intersect2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Intersect((new int[] { 1, 2, 3 }).AsQueryable(), EqualityComparer.Default).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Intersect(new[] { 1, 2, 3 }.AsQueryable(), EqualityComparer.Default).Count(); Assert.Equal(2, count); } diff --git a/src/libraries/System.Linq.Queryable/tests/JoinTests.cs b/src/libraries/System.Linq.Queryable/tests/JoinTests.cs index 6b6df7448ca36..c170867faea41 100644 --- a/src/libraries/System.Linq.Queryable/tests/JoinTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/JoinTests.cs @@ -39,20 +39,17 @@ public struct JoinRec [Fact] public void FirstOuterMatchesLastInnerLastOuterMatchesFirstInnerSameNumberElements() { - CustomerRec[] outer = new [] - { + CustomerRec[] outer = { new CustomerRec{ name = "Prakash", custID = 98022 }, new CustomerRec{ name = "Tim", custID = 99021 }, new CustomerRec{ name = "Robert", custID = 99022 } }; - OrderRec[] inner = new [] - { + OrderRec[] inner = { new OrderRec{ orderID = 45321, custID = 99022, total = 50 }, new OrderRec{ orderID = 43421, custID = 29022, total = 20 }, new OrderRec{ orderID = 95421, custID = 98022, total = 9 } }; - JoinRec[] expected = new [] - { + JoinRec[] expected = { new JoinRec{ name = "Prakash", orderID = 95421, total = 9 }, new JoinRec{ name = "Robert", orderID = 45321, total = 50 } }; @@ -63,18 +60,16 @@ public void FirstOuterMatchesLastInnerLastOuterMatchesFirstInnerSameNumberElemen [Fact] public void NullComparer() { - CustomerRec[] outer = new [] - { + CustomerRec[] outer = { new CustomerRec{ name = "Prakash", custID = 98022 }, new CustomerRec{ name = "Tim", custID = 99021 }, new CustomerRec{ name = "Robert", custID = 99022 } }; - AnagramRec[] inner = new [] - { + AnagramRec[] inner = { new AnagramRec{ name = "miT", orderID = 43455, total = 10 }, new AnagramRec{ name = "Prakash", orderID = 323232, total = 9 } }; - JoinRec[] expected = new [] { new JoinRec{ name = "Prakash", orderID = 323232, total = 9 } }; + JoinRec[] expected = { new JoinRec{ name = "Prakash", orderID = 323232, total = 9 } }; Assert.Equal(expected, outer.AsQueryable().Join(inner.AsQueryable(), e => e.name, e => e.name, (cr, or) => new JoinRec { name = cr.name, orderID = or.orderID, total = or.total }, null)); } @@ -82,19 +77,16 @@ public void NullComparer() [Fact] public void CustomComparer() { - CustomerRec[] outer = new [] - { + CustomerRec[] outer = { new CustomerRec{ name = "Prakash", custID = 98022 }, new CustomerRec{ name = "Tim", custID = 99021 }, new CustomerRec{ name = "Robert", custID = 99022 } }; - AnagramRec[] inner = new [] - { + AnagramRec[] inner = { new AnagramRec{ name = "miT", orderID = 43455, total = 10 }, new AnagramRec{ name = "Prakash", orderID = 323232, total = 9 } }; - JoinRec[] expected = new [] - { + JoinRec[] expected = { new JoinRec{ name = "Prakash", orderID = 323232, total = 9 }, new JoinRec{ name = "Tim", orderID = 43455, total = 10 } }; @@ -106,8 +98,7 @@ public void CustomComparer() public void OuterNull() { IQueryable outer = null; - AnagramRec[] inner = new [] - { + AnagramRec[] inner = { new AnagramRec{ name = "miT", orderID = 43455, total = 10 }, new AnagramRec{ name = "Prakash", orderID = 323232, total = 9 } }; @@ -118,8 +109,7 @@ public void OuterNull() [Fact] public void InnerNull() { - CustomerRec[] outer = new [] - { + CustomerRec[] outer = { new CustomerRec{ name = "Prakash", custID = 98022 }, new CustomerRec{ name = "Tim", custID = 99021 }, new CustomerRec{ name = "Robert", custID = 99022 } @@ -132,14 +122,12 @@ public void InnerNull() [Fact] public void OuterKeySelectorNull() { - CustomerRec[] outer = new [] - { + CustomerRec[] outer = { new CustomerRec{ name = "Prakash", custID = 98022 }, new CustomerRec{ name = "Tim", custID = 99021 }, new CustomerRec{ name = "Robert", custID = 99022 } }; - AnagramRec[] inner = new [] - { + AnagramRec[] inner = { new AnagramRec{ name = "miT", orderID = 43455, total = 10 }, new AnagramRec{ name = "Prakash", orderID = 323232, total = 9 } }; @@ -150,14 +138,12 @@ public void OuterKeySelectorNull() [Fact] public void InnerKeySelectorNull() { - CustomerRec[] outer = new [] - { + CustomerRec[] outer = { new CustomerRec{ name = "Prakash", custID = 98022 }, new CustomerRec{ name = "Tim", custID = 99021 }, new CustomerRec{ name = "Robert", custID = 99022 } }; - AnagramRec[] inner = new [] - { + AnagramRec[] inner = { new AnagramRec{ name = "miT", orderID = 43455, total = 10 }, new AnagramRec{ name = "Prakash", orderID = 323232, total = 9 } }; @@ -168,14 +154,12 @@ public void InnerKeySelectorNull() [Fact] public void ResultSelectorNull() { - CustomerRec[] outer = new [] - { + CustomerRec[] outer = { new CustomerRec{ name = "Prakash", custID = 98022 }, new CustomerRec{ name = "Tim", custID = 99021 }, new CustomerRec{ name = "Robert", custID = 99022 } }; - AnagramRec[] inner = new [] - { + AnagramRec[] inner = { new AnagramRec{ name = "miT", orderID = 43455, total = 10 }, new AnagramRec{ name = "Prakash", orderID = 323232, total = 9 } }; @@ -187,8 +171,7 @@ public void ResultSelectorNull() public void OuterNullNoComparer() { IQueryable outer = null; - AnagramRec[] inner = new[] - { + AnagramRec[] inner = { new AnagramRec{ name = "miT", orderID = 43455, total = 10 }, new AnagramRec{ name = "Prakash", orderID = 323232, total = 9 } }; @@ -199,8 +182,7 @@ public void OuterNullNoComparer() [Fact] public void InnerNullNoComparer() { - CustomerRec[] outer = new[] - { + CustomerRec[] outer = { new CustomerRec{ name = "Prakash", custID = 98022 }, new CustomerRec{ name = "Tim", custID = 99021 }, new CustomerRec{ name = "Robert", custID = 99022 } @@ -213,14 +195,12 @@ public void InnerNullNoComparer() [Fact] public void OuterKeySelectorNullNoComparer() { - CustomerRec[] outer = new[] - { + CustomerRec[] outer = { new CustomerRec{ name = "Prakash", custID = 98022 }, new CustomerRec{ name = "Tim", custID = 99021 }, new CustomerRec{ name = "Robert", custID = 99022 } }; - AnagramRec[] inner = new[] - { + AnagramRec[] inner = { new AnagramRec{ name = "miT", orderID = 43455, total = 10 }, new AnagramRec{ name = "Prakash", orderID = 323232, total = 9 } }; @@ -231,14 +211,12 @@ public void OuterKeySelectorNullNoComparer() [Fact] public void InnerKeySelectorNullNoComparer() { - CustomerRec[] outer = new[] - { + CustomerRec[] outer = { new CustomerRec{ name = "Prakash", custID = 98022 }, new CustomerRec{ name = "Tim", custID = 99021 }, new CustomerRec{ name = "Robert", custID = 99022 } }; - AnagramRec[] inner = new[] - { + AnagramRec[] inner = { new AnagramRec{ name = "miT", orderID = 43455, total = 10 }, new AnagramRec{ name = "Prakash", orderID = 323232, total = 9 } }; @@ -249,14 +227,12 @@ public void InnerKeySelectorNullNoComparer() [Fact] public void ResultSelectorNullNoComparer() { - CustomerRec[] outer = new[] - { + CustomerRec[] outer = { new CustomerRec{ name = "Prakash", custID = 98022 }, new CustomerRec{ name = "Tim", custID = 99021 }, new CustomerRec{ name = "Robert", custID = 99022 } }; - AnagramRec[] inner = new[] - { + AnagramRec[] inner = { new AnagramRec{ name = "miT", orderID = 43455, total = 10 }, new AnagramRec{ name = "Prakash", orderID = 323232, total = 9 } }; @@ -275,14 +251,14 @@ public void SelectorsReturnNull() [Fact] public void Join1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Join(new int[] { 1, 2, 3 }, n1 => n1, n2 => n2, (n1, n2) => n1 + n2).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Join(new[] { 1, 2, 3 }, n1 => n1, n2 => n2, (n1, n2) => n1 + n2).Count(); Assert.Equal(2, count); } [Fact] public void Join2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Join(new int[] { 1, 2, 3 }, n1 => n1, n2 => n2, (n1, n2) => n1 + n2, EqualityComparer.Default).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Join(new[] { 1, 2, 3 }, n1 => n1, n2 => n2, (n1, n2) => n1 + n2, EqualityComparer.Default).Count(); Assert.Equal(2, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/LastOrDefaultTests.cs b/src/libraries/System.Linq.Queryable/tests/LastOrDefaultTests.cs index d65a9eb27d1e7..024a2bc0b0391 100644 --- a/src/libraries/System.Linq.Queryable/tests/LastOrDefaultTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/LastOrDefaultTests.cs @@ -86,14 +86,14 @@ public void NullPredicate() [Fact] public void LastOrDefault1() { - var val = (new int[] { 0, 1, 2 }).AsQueryable().LastOrDefault(); + var val = new[] { 0, 1, 2 }.AsQueryable().LastOrDefault(); Assert.Equal(2, val); } [Fact] public void LastOrDefault2() { - var val = (new int[] { 0, 1, 2 }).AsQueryable().LastOrDefault(n => n > 1); + var val = new[] { 0, 1, 2 }.AsQueryable().LastOrDefault(n => n > 1); Assert.Equal(2, val); } diff --git a/src/libraries/System.Linq.Queryable/tests/LastTests.cs b/src/libraries/System.Linq.Queryable/tests/LastTests.cs index 8cc954ad9647b..2319e147ac8ce 100644 --- a/src/libraries/System.Linq.Queryable/tests/LastTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/LastTests.cs @@ -73,14 +73,14 @@ public void NullPredicate() [Fact] public void Last1() { - var val = (new int[] { 0, 1, 2 }).AsQueryable().Last(); + var val = new[] { 0, 1, 2 }.AsQueryable().Last(); Assert.Equal(2, val); } [Fact] public void Last2() { - var val = (new int[] { 0, 1, 2 }).AsQueryable().Last(n => n > 1); + var val = new[] { 0, 1, 2 }.AsQueryable().Last(n => n > 1); Assert.Equal(2, val); } } diff --git a/src/libraries/System.Linq.Queryable/tests/LongCountTests.cs b/src/libraries/System.Linq.Queryable/tests/LongCountTests.cs index fcc0f1ea3da03..64e2ac1adb882 100644 --- a/src/libraries/System.Linq.Queryable/tests/LongCountTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/LongCountTests.cs @@ -58,14 +58,14 @@ public void NullPredicateUsed() [Fact] public void LongCount1() { - var count = (new int[] { 0 }).AsQueryable().LongCount(); + var count = new[] { 0 }.AsQueryable().LongCount(); Assert.Equal(1L, count); } [Fact] public void LongCount2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().LongCount(n => n > 0); + var count = new[] { 0, 1, 2 }.AsQueryable().LongCount(n => n > 0); Assert.Equal(2L, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/MaxTests.cs b/src/libraries/System.Linq.Queryable/tests/MaxTests.cs index 84a56d5b856d5..6c487c7c92f86 100644 --- a/src/libraries/System.Linq.Queryable/tests/MaxTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/MaxTests.cs @@ -580,14 +580,14 @@ public void EmptyBoolean() [Fact] public void Max1() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Max(); + var val = new[] { 0, 2, 1 }.AsQueryable().Max(); Assert.Equal(2, val); } [Fact] public void Max2() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Max(n => n); + var val = new[] { 0, 2, 1 }.AsQueryable().Max(n => n); Assert.Equal(2, val); } diff --git a/src/libraries/System.Linq.Queryable/tests/MinTests.cs b/src/libraries/System.Linq.Queryable/tests/MinTests.cs index 8e9a8a6680b86..2cbee36d71386 100644 --- a/src/libraries/System.Linq.Queryable/tests/MinTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/MinTests.cs @@ -548,14 +548,14 @@ public void EmptyBooleanSource() [Fact] public void Min1() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Min(); + var val = new[] { 0, 2, 1 }.AsQueryable().Min(); Assert.Equal(0, val); } [Fact] public void Min2() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Min(n => n); + var val = new[] { 0, 2, 1 }.AsQueryable().Min(n => n); Assert.Equal(0, val); } diff --git a/src/libraries/System.Linq.Queryable/tests/OfTypeTests.cs b/src/libraries/System.Linq.Queryable/tests/OfTypeTests.cs index d8e7bb09ed151..d1688e68c6b44 100644 --- a/src/libraries/System.Linq.Queryable/tests/OfTypeTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/OfTypeTests.cs @@ -32,7 +32,7 @@ public void NullSource() [Fact] public void OfType() { - var count = (new object[] { 0, (long)1, 2 }).AsQueryable().OfType().Count(); + var count = new object[] { 0, (long)1, 2 }.AsQueryable().OfType().Count(); Assert.Equal(2, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/OrderByDescendingTests.cs b/src/libraries/System.Linq.Queryable/tests/OrderByDescendingTests.cs index 003ee53f48a97..a01bbe4e201e9 100644 --- a/src/libraries/System.Linq.Queryable/tests/OrderByDescendingTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/OrderByDescendingTests.cs @@ -80,14 +80,14 @@ public void NullKeySelectorComparer() [Fact] public void OrderByDescending1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().OrderByDescending(n => n).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().OrderByDescending(n => n).Count(); Assert.Equal(3, count); } [Fact] public void OrderByDescending2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().OrderByDescending(n => n, Comparer.Default).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().OrderByDescending(n => n, Comparer.Default).Count(); Assert.Equal(3, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/OrderByTests.cs b/src/libraries/System.Linq.Queryable/tests/OrderByTests.cs index d81142dc2f1ac..f22a437c45653 100644 --- a/src/libraries/System.Linq.Queryable/tests/OrderByTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/OrderByTests.cs @@ -77,14 +77,14 @@ public void NullKeySelectorComparer() [Fact] public void OrderBy1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().OrderBy(n => n).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().OrderBy(n => n).Count(); Assert.Equal(3, count); } [Fact] public void OrderBy2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().OrderBy(n => n, Comparer.Default).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().OrderBy(n => n, Comparer.Default).Count(); Assert.Equal(3, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/OrderDescendingTests.cs b/src/libraries/System.Linq.Queryable/tests/OrderDescendingTests.cs index aa30e2d81b98e..e2613e61f304b 100644 --- a/src/libraries/System.Linq.Queryable/tests/OrderDescendingTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/OrderDescendingTests.cs @@ -43,14 +43,14 @@ public void NullSourceComparer() [Fact] public void OrderDescending1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().OrderDescending().Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().OrderDescending().Count(); Assert.Equal(3, count); } [Fact] public void OrderDescending2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().OrderDescending(Comparer.Default).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().OrderDescending(Comparer.Default).Count(); Assert.Equal(3, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/OrderTests.cs b/src/libraries/System.Linq.Queryable/tests/OrderTests.cs index 7cf69256d7ca7..ac2b9699a75f8 100644 --- a/src/libraries/System.Linq.Queryable/tests/OrderTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/OrderTests.cs @@ -43,14 +43,14 @@ public void NullSourceComparer() [Fact] public void Order1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Order().Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Order().Count(); Assert.Equal(3, count); } [Fact] public void Order2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Order(Comparer.Default).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Order(Comparer.Default).Count(); Assert.Equal(3, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/QueryFromExpressionTests.cs b/src/libraries/System.Linq.Queryable/tests/QueryFromExpressionTests.cs index 314646de5e676..5e11d6388b9a8 100644 --- a/src/libraries/System.Linq.Queryable/tests/QueryFromExpressionTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/QueryFromExpressionTests.cs @@ -76,7 +76,7 @@ public void PropertyAccess() { Expression access = Expression.Property(null, typeof(QueryFromExpressionTests), "AsciiControlCharacters"); IQueryable q = _prov.CreateQuery(access); - Assert.Equal(Enumerable.Range(0, 128).Select(i => (char)i).Where(c => char.IsControl(c)), q); + Assert.Equal(Enumerable.Range(0, 128).Select(i => (char)i).Where(char.IsControl), q); } [Fact] diff --git a/src/libraries/System.Linq.Queryable/tests/Queryable.cs b/src/libraries/System.Linq.Queryable/tests/Queryable.cs index 5ccedaccacb64..1ffd4b4fc17fb 100644 --- a/src/libraries/System.Linq.Queryable/tests/Queryable.cs +++ b/src/libraries/System.Linq.Queryable/tests/Queryable.cs @@ -16,13 +16,13 @@ public class QueryableTests [Fact] public void AsQueryable() { - Assert.NotNull(((IEnumerable)(new int[] { })).AsQueryable()); + Assert.NotNull(((IEnumerable)new int[] { }).AsQueryable()); } [Fact] public void AsQueryableT() { - Assert.NotNull((new int[] { }).AsQueryable()); + Assert.NotNull(new int[] { }.AsQueryable()); } [Fact] diff --git a/src/libraries/System.Linq.Queryable/tests/ReverseTests.cs b/src/libraries/System.Linq.Queryable/tests/ReverseTests.cs index 32a6b466cc548..d26a40784e42c 100644 --- a/src/libraries/System.Linq.Queryable/tests/ReverseTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/ReverseTests.cs @@ -15,10 +15,10 @@ public void InvalidArguments() [Theory] [InlineData(new int[] { })] - [InlineData(new int[] { 1 })] - [InlineData(new int[] { 5 })] - [InlineData(new int[] { 1, 3, 5 })] - [InlineData(new int[] { 2, 4, 6, 8 })] + [InlineData(new[] { 1 })] + [InlineData(new[] { 5 })] + [InlineData(new[] { 1, 3, 5 })] + [InlineData(new[] { 2, 4, 6, 8 })] public void ReverseMatches(int[] input) { int[] expectedResults = new int[input.Length]; @@ -33,8 +33,8 @@ public void ReverseMatches(int[] input) [Fact] public void SomeRepeatedElements() { - int?[] source = new int?[] { -10, 0, 5, null, 0, 9, 100, null, 9 }; - int?[] expected = new int?[] { 9, null, 100, 9, 0, null, 5, 0, -10 }; + int?[] source = { -10, 0, 5, null, 0, 9, 100, null, 9 }; + int?[] expected = { 9, null, 100, 9, 0, null, 5, 0, -10 }; Assert.Equal(expected, source.AsQueryable().Reverse()); } @@ -42,7 +42,7 @@ public void SomeRepeatedElements() [Fact] public void Reverse() { - var count = (new int[] { 0, 2, 1 }).AsQueryable().Reverse().Count(); + var count = new[] { 0, 2, 1 }.AsQueryable().Reverse().Count(); Assert.Equal(3, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/SelectManyTests.cs b/src/libraries/System.Linq.Queryable/tests/SelectManyTests.cs index ad1b455120521..8ae998796b090 100644 --- a/src/libraries/System.Linq.Queryable/tests/SelectManyTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/SelectManyTests.cs @@ -144,28 +144,28 @@ public void IndexCausingLastToBeSelectedWithResultSelector() [Fact] public void SelectMany1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().SelectMany(n => new int[] { n + 4, 5 }).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().SelectMany(n => new[] { n + 4, 5 }).Count(); Assert.Equal(6, count); } [Fact] public void SelectMany2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().SelectMany((n, i) => new int[] { 4 + i, 5 + n }).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().SelectMany((n, i) => new[] { 4 + i, 5 + n }).Count(); Assert.Equal(6, count); } [Fact] public void SelectMany3() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().SelectMany(n => new long[] { n + 4, 5 }, (n1, n2) => (n1 + n2).ToString()).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().SelectMany(n => new long[] { n + 4, 5 }, (n1, n2) => (n1 + n2).ToString()).Count(); Assert.Equal(6, count); } [Fact] public void SelectMany4() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().SelectMany((n, i) => new long[] { 4 + i, 5 + n }, (n1, n2) => (n1 + n2).ToString()).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().SelectMany((n, i) => new long[] { 4 + i, 5 + n }, (n1, n2) => (n1 + n2).ToString()).Count(); Assert.Equal(6, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/SelectTests.cs b/src/libraries/System.Linq.Queryable/tests/SelectTests.cs index 0a58cc85d531f..8869ee3d4b350 100644 --- a/src/libraries/System.Linq.Queryable/tests/SelectTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/SelectTests.cs @@ -69,14 +69,14 @@ public void Select_SelectorIsNull_ArgumentNullExceptionThrown() [Fact] public void Select1() { - var count = (new object[] { 0, 1, 2 }).AsQueryable().Select(o => (int)o).Count(); + var count = new object[] { 0, 1, 2 }.AsQueryable().Select(o => (int)o).Count(); Assert.Equal(3, count); } [Fact] public void Select2() { - var count = (new object[] { 0, 1, 2 }).AsQueryable().Select((o, i) => (int)o + i).Count(); + var count = new object[] { 0, 1, 2 }.AsQueryable().Select((o, i) => (int)o + i).Count(); Assert.Equal(3, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/SequenceEqualTests.cs b/src/libraries/System.Linq.Queryable/tests/SequenceEqualTests.cs index 5925031b8dd5e..1ba47fdbc9a6b 100644 --- a/src/libraries/System.Linq.Queryable/tests/SequenceEqualTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/SequenceEqualTests.cs @@ -57,14 +57,14 @@ public void SecondSourceNull() [Fact] public void SequenceEqual1() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().SequenceEqual(new int[] { 0, 2, 1 }); + var val = new[] { 0, 2, 1 }.AsQueryable().SequenceEqual(new[] { 0, 2, 1 }); Assert.True(val); } [Fact] public void SequenceEqual2() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().SequenceEqual(new int[] { 0, 2, 1 }, EqualityComparer.Default); + var val = new[] { 0, 2, 1 }.AsQueryable().SequenceEqual(new[] { 0, 2, 1 }, EqualityComparer.Default); Assert.True(val); } } diff --git a/src/libraries/System.Linq.Queryable/tests/SingleOrDefaultTests.cs b/src/libraries/System.Linq.Queryable/tests/SingleOrDefaultTests.cs index 991ac5106ba87..b0b623c1d0ad6 100644 --- a/src/libraries/System.Linq.Queryable/tests/SingleOrDefaultTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/SingleOrDefaultTests.cs @@ -69,14 +69,14 @@ public void ThrowsOnNullPredicate() [Fact] public void SingleOrDefault1() { - var val = (new int[] { 2 }).AsQueryable().SingleOrDefault(); + var val = new[] { 2 }.AsQueryable().SingleOrDefault(); Assert.Equal(2, val); } [Fact] public void SingleOrDefault2() { - var val = (new int[] { 2 }).AsQueryable().SingleOrDefault(n => n > 1); + var val = new[] { 2 }.AsQueryable().SingleOrDefault(n => n > 1); Assert.Equal(2, val); } diff --git a/src/libraries/System.Linq.Queryable/tests/SingleTests.cs b/src/libraries/System.Linq.Queryable/tests/SingleTests.cs index 68ba9d544d36c..062f7adfc147e 100644 --- a/src/libraries/System.Linq.Queryable/tests/SingleTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/SingleTests.cs @@ -77,14 +77,14 @@ public void ThrowsOnNullPredicate() [Fact] public void Single1() { - var val = (new int[] { 2 }).AsQueryable().Single(); + var val = new[] { 2 }.AsQueryable().Single(); Assert.Equal(2, val); } [Fact] public void Single2() { - var val = (new int[] { 2 }).AsQueryable().Single(n => n > 1); + var val = new[] { 2 }.AsQueryable().Single(n => n > 1); Assert.Equal(2, val); } } diff --git a/src/libraries/System.Linq.Queryable/tests/SkipTests.cs b/src/libraries/System.Linq.Queryable/tests/SkipTests.cs index 139bd73c0f27e..3627b4451e10d 100644 --- a/src/libraries/System.Linq.Queryable/tests/SkipTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/SkipTests.cs @@ -28,7 +28,7 @@ public void SkipThrowsOnNull() [Fact] public void Skip() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Skip(1).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Skip(1).Count(); Assert.Equal(2, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/SkipWhileTests.cs b/src/libraries/System.Linq.Queryable/tests/SkipWhileTests.cs index 38e0d7bb09df8..755c426e50a53 100644 --- a/src/libraries/System.Linq.Queryable/tests/SkipWhileTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/SkipWhileTests.cs @@ -34,14 +34,14 @@ public void SkipWhileThrowsOnNull() [Fact] public void SkipWhile1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().SkipWhile(n => n < 1).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().SkipWhile(n => n < 1).Count(); Assert.Equal(2, count); } [Fact] public void SkipWhile2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().SkipWhile((n, i) => n + i < 1).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().SkipWhile((n, i) => n + i < 1).Count(); Assert.Equal(2, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/SumTests.cs b/src/libraries/System.Linq.Queryable/tests/SumTests.cs index 4b5dc453e70cd..c875cce64b7b8 100644 --- a/src/libraries/System.Linq.Queryable/tests/SumTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/SumTests.cs @@ -251,140 +251,140 @@ public void SumOfNullableOfDecimal_SourceIsEmptyCollection_ZeroReturned() [Fact] public void Sum1() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Sum(); + var val = new[] { 0, 2, 1 }.AsQueryable().Sum(); Assert.Equal((int)3, val); } [Fact] public void Sum2() { - var val = (new int?[] { 0, 2, 1 }).AsQueryable().Sum(); + var val = new int?[] { 0, 2, 1 }.AsQueryable().Sum(); Assert.Equal((int)3, val); } [Fact] public void Sum3() { - var val = (new long[] { 0, 2, 1 }).AsQueryable().Sum(); + var val = new long[] { 0, 2, 1 }.AsQueryable().Sum(); Assert.Equal((long)3, val); } [Fact] public void Sum4() { - var val = (new long?[] { 0, 2, 1 }).AsQueryable().Sum(); + var val = new long?[] { 0, 2, 1 }.AsQueryable().Sum(); Assert.Equal((long)3, val); } [Fact] public void Sum5() { - var val = (new float[] { 0, 2, 1 }).AsQueryable().Sum(); + var val = new float[] { 0, 2, 1 }.AsQueryable().Sum(); Assert.Equal((float)3, val); } [Fact] public void Sum6() { - var val = (new float?[] { 0, 2, 1 }).AsQueryable().Sum(); + var val = new float?[] { 0, 2, 1 }.AsQueryable().Sum(); Assert.Equal((float)3, val); } [Fact] public void Sum7() { - var val = (new double[] { 0, 2, 1 }).AsQueryable().Sum(); + var val = new double[] { 0, 2, 1 }.AsQueryable().Sum(); Assert.Equal((double)3, val); } [Fact] public void Sum8() { - var val = (new double?[] { 0, 2, 1 }).AsQueryable().Sum(); + var val = new double?[] { 0, 2, 1 }.AsQueryable().Sum(); Assert.Equal((double)3, val); } [Fact] public void Sum9() { - var val = (new decimal[] { 0, 2, 1 }).AsQueryable().Sum(); + var val = new decimal[] { 0, 2, 1 }.AsQueryable().Sum(); Assert.Equal((decimal)3, val); } [Fact] public void Sum10() { - var val = (new decimal?[] { 0, 2, 1 }).AsQueryable().Sum(); + var val = new decimal?[] { 0, 2, 1 }.AsQueryable().Sum(); Assert.Equal((decimal)3, val); } [Fact] public void Sum11() { - var val = (new int[] { 0, 2, 1 }).AsQueryable().Sum(n => n); + var val = new[] { 0, 2, 1 }.AsQueryable().Sum(n => n); Assert.Equal((int)3, val); } [Fact] public void Sum12() { - var val = (new int?[] { 0, 2, 1 }).AsQueryable().Sum(n => n); + var val = new int?[] { 0, 2, 1 }.AsQueryable().Sum(n => n); Assert.Equal((int)3, val); } [Fact] public void Sum13() { - var val = (new long[] { 0, 2, 1 }).AsQueryable().Sum(n => n); + var val = new long[] { 0, 2, 1 }.AsQueryable().Sum(n => n); Assert.Equal((long)3, val); } [Fact] public void Sum14() { - var val = (new long?[] { 0, 2, 1 }).AsQueryable().Sum(n => n); + var val = new long?[] { 0, 2, 1 }.AsQueryable().Sum(n => n); Assert.Equal((long)3, val); } [Fact] public void Sum15() { - var val = (new float[] { 0, 2, 1 }).AsQueryable().Sum(n => n); + var val = new float[] { 0, 2, 1 }.AsQueryable().Sum(n => n); Assert.Equal((float)3, val); } [Fact] public void Sum16() { - var val = (new float?[] { 0, 2, 1 }).AsQueryable().Sum(n => n); + var val = new float?[] { 0, 2, 1 }.AsQueryable().Sum(n => n); Assert.Equal((float)3, val); } [Fact] public void Sum17() { - var val = (new double[] { 0, 2, 1 }).AsQueryable().Sum(n => n); + var val = new double[] { 0, 2, 1 }.AsQueryable().Sum(n => n); Assert.Equal((double)3, val); } [Fact] public void Sum18() { - var val = (new double?[] { 0, 2, 1 }).AsQueryable().Sum(n => n); + var val = new double?[] { 0, 2, 1 }.AsQueryable().Sum(n => n); Assert.Equal((double)3, val); } [Fact] public void Sum19() { - var val = (new decimal[] { 0, 2, 1 }).AsQueryable().Sum(n => n); + var val = new decimal[] { 0, 2, 1 }.AsQueryable().Sum(n => n); Assert.Equal((decimal)3, val); } [Fact] public void Sum20() { - var val = (new decimal?[] { 0, 2, 1 }).AsQueryable().Sum(n => n); + var val = new decimal?[] { 0, 2, 1 }.AsQueryable().Sum(n => n); Assert.Equal((decimal)3, val); } } diff --git a/src/libraries/System.Linq.Queryable/tests/TakeWhileTests.cs b/src/libraries/System.Linq.Queryable/tests/TakeWhileTests.cs index 6a0ac951084ff..8d88b323fb698 100644 --- a/src/libraries/System.Linq.Queryable/tests/TakeWhileTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/TakeWhileTests.cs @@ -59,14 +59,14 @@ public void ThrowsOnNullPredicateIndexed() [Fact] public void TakeWhile1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().TakeWhile(n => n < 2).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().TakeWhile(n => n < 2).Count(); Assert.Equal(2, count); } [Fact] public void TakeWhile2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().TakeWhile((n, i) => n + i < 4).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().TakeWhile((n, i) => n + i < 4).Count(); Assert.Equal(2, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/ThenByDescendingTests.cs b/src/libraries/System.Linq.Queryable/tests/ThenByDescendingTests.cs index 6e266541f9b98..1c2389772e37a 100644 --- a/src/libraries/System.Linq.Queryable/tests/ThenByDescendingTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/ThenByDescendingTests.cs @@ -63,14 +63,14 @@ public void NullKeySelectorComparer() [Fact] public void ThenByDescending1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().OrderBy(n => n).ThenByDescending(n => n).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().OrderBy(n => n).ThenByDescending(n => n).Count(); Assert.Equal(3, count); } [Fact] public void ThenByDescending2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().OrderBy(n => n).ThenByDescending(n => n, Comparer.Default).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().OrderBy(n => n).ThenByDescending(n => n, Comparer.Default).Count(); Assert.Equal(3, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/ThenByTests.cs b/src/libraries/System.Linq.Queryable/tests/ThenByTests.cs index 3955c2d79da35..75d2e8033fd79 100644 --- a/src/libraries/System.Linq.Queryable/tests/ThenByTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/ThenByTests.cs @@ -63,14 +63,14 @@ public void NullKeySelectorComparer() [Fact] public void ThenBy1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().OrderBy(n => n).ThenBy(n => n).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().OrderBy(n => n).ThenBy(n => n).Count(); Assert.Equal(3, count); } [Fact] public void ThenBy2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().OrderBy(n => n).ThenBy(n => n, Comparer.Default).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().OrderBy(n => n).ThenBy(n => n, Comparer.Default).Count(); Assert.Equal(3, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/TrimCompatibilityTests.cs b/src/libraries/System.Linq.Queryable/tests/TrimCompatibilityTests.cs index dfcff830d8dee..86faa014ef1db 100644 --- a/src/libraries/System.Linq.Queryable/tests/TrimCompatibilityTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/TrimCompatibilityTests.cs @@ -45,42 +45,6 @@ public static void QueryableMethodsContainCorrectDynamicDependency() } } - /// - /// Verifies that all methods in CachedReflectionInfo that call MakeGenericMethod - /// call it on a method that doesn't contain any trimming annotations (i.e. DynamicallyAccessedMembers). - /// - /// - /// This ensures it is safe to suppress IL2060:MakeGenericMethod warnings in the CachedReflectionInfo class. - /// - [Fact] - public static void CachedReflectionInfoMethodsNoAnnotations() - { - IEnumerable methods = - typeof(Queryable).Assembly - .GetType("System.Linq.CachedReflectionInfo") - .GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static) - .Where(m => m.GetParameters().Length > 0); - - // If you are adding a new method to this class, ensure the method meets these requirements - Assert.Equal(135, methods.Count()); - foreach (MethodInfo method in methods) - { - ParameterInfo[] parameters = method.GetParameters(); - - Type[] args = new Type[parameters.Length]; - for (int i = 0; i < args.Length; i++) - { - args[i] = typeof(object); - } - - MethodInfo resultMethodInfo = (MethodInfo)method.Invoke(null, args); - Assert.True(resultMethodInfo.IsConstructedGenericMethod); - MethodInfo originalGenericDefinition = resultMethodInfo.GetGenericMethodDefinition(); - - EnsureNoTrimAnnotations(originalGenericDefinition); - } - } - /// /// Verifies that all methods in Enumerable don't contain any trimming annotations (i.e. DynamicallyAccessedMembers). /// diff --git a/src/libraries/System.Linq.Queryable/tests/UnionTests.cs b/src/libraries/System.Linq.Queryable/tests/UnionTests.cs index 1d6d9ae6afe0a..67fd1ae77316c 100644 --- a/src/libraries/System.Linq.Queryable/tests/UnionTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/UnionTests.cs @@ -70,14 +70,14 @@ public void CommonElementsShared() [Fact] public void Union1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Union((new int[] { 1, 2, 3 }).AsQueryable()).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Union(new[] { 1, 2, 3 }.AsQueryable()).Count(); Assert.Equal(4, count); } [Fact] public void Union2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Union((new int[] { 1, 2, 3 }).AsQueryable(), EqualityComparer.Default).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Union(new[] { 1, 2, 3 }.AsQueryable(), EqualityComparer.Default).Count(); Assert.Equal(4, count); } diff --git a/src/libraries/System.Linq.Queryable/tests/WhereTests.cs b/src/libraries/System.Linq.Queryable/tests/WhereTests.cs index c3454c68370fe..012f69e4ff096 100644 --- a/src/libraries/System.Linq.Queryable/tests/WhereTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/WhereTests.cs @@ -30,42 +30,42 @@ public void Where_PredicateIsNull_ArgumentNullExceptionThrown() [Fact] public void ReturnsExpectedValues_True() { - int[] source = new[] { 1, 2, 3, 4, 5 }; + int[] source = { 1, 2, 3, 4, 5 }; Assert.Equal(source, source.AsQueryable().Where(i => true)); } [Fact] public void ReturnsExpectedValues_False() { - int[] source = new[] { 1, 2, 3, 4, 5 }; + int[] source = { 1, 2, 3, 4, 5 }; Assert.Empty(source.AsQueryable().Where(i => false)); } [Fact] public void ReturnsExpectedValuesIndexed_True() { - int[] source = new[] { 1, 2, 3, 4, 5 }; + int[] source = { 1, 2, 3, 4, 5 }; Assert.Equal(source, source.AsQueryable().Where((e, i) => true)); } [Fact] public void ReturnsExpectedValuesIndexed_False() { - int[] source = new[] { 1, 2, 3, 4, 5 }; + int[] source = { 1, 2, 3, 4, 5 }; Assert.Empty(source.AsQueryable().Where((e, i) => false)); } [Fact] public void Where1() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Where(n => n > 1).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Where(n => n > 1).Count(); Assert.Equal(1, count); } [Fact] public void Where2() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Where((n, i) => n > 1 || i == 0).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Where((n, i) => n > 1 || i == 0).Count(); Assert.Equal(2, count); } } diff --git a/src/libraries/System.Linq.Queryable/tests/ZipTests.cs b/src/libraries/System.Linq.Queryable/tests/ZipTests.cs index 26498693a2988..4f019b2636f91 100644 --- a/src/libraries/System.Linq.Queryable/tests/ZipTests.cs +++ b/src/libraries/System.Linq.Queryable/tests/ZipTests.cs @@ -11,9 +11,9 @@ public class ZipTests : EnumerableBasedTests [Fact] public void CorrectResults() { - int[] first = new int[] { 1, 2, 3 }; - int[] second = new int[] { 2, 5, 9 }; - int[] expected = new int[] { 3, 7, 12 }; + int[] first = { 1, 2, 3 }; + int[] second = { 2, 5, 9 }; + int[] expected = { 3, 7, 12 }; Assert.Equal(expected, first.AsQueryable().Zip(second.AsQueryable(), (x, y) => x + y)); } @@ -21,14 +21,14 @@ public void CorrectResults() public void FirstIsNull() { IQueryable first = null; - int[] second = new int[] { 2, 5, 9 }; + int[] second = { 2, 5, 9 }; AssertExtensions.Throws("source1", () => first.Zip(second.AsQueryable(), (x, y) => x + y)); } [Fact] public void SecondIsNull() { - int[] first = new int[] { 1, 2, 3 }; + int[] first = { 1, 2, 3 }; IQueryable second = null; AssertExtensions.Throws("source2", () => first.AsQueryable().Zip(second, (x, y) => x + y)); } @@ -36,8 +36,8 @@ public void SecondIsNull() [Fact] public void FuncIsNull() { - IQueryable first = new int[] { 1, 2, 3 }.AsQueryable(); - IQueryable second = new int[] { 2, 4, 6 }.AsQueryable(); + IQueryable first = new[] { 1, 2, 3 }.AsQueryable(); + IQueryable second = new[] { 2, 4, 6 }.AsQueryable(); Expression> func = null; AssertExtensions.Throws("resultSelector", () => first.Zip(second, func)); } @@ -45,16 +45,16 @@ public void FuncIsNull() [Fact] public void Zip() { - var count = (new int[] { 0, 1, 2 }).AsQueryable().Zip((new int[] { 10, 11, 12 }).AsQueryable(), (n1, n2) => n1 + n2).Count(); + var count = new[] { 0, 1, 2 }.AsQueryable().Zip(new[] { 10, 11, 12 }.AsQueryable(), (n1, n2) => n1 + n2).Count(); Assert.Equal(3, count); } [Fact] public void Zip2_CorrectResults() { - int[] first = new int[] { 1, 2, 3 }; - int[] second = new int[] { 2, 5, 9 }; - var expected = new (int, int)[] { (1, 2), (2, 5), (3, 9) }; + int[] first = { 1, 2, 3 }; + int[] second = { 2, 5, 9 }; + var expected = new[] { (1, 2), (2, 5), (3, 9) }; Assert.Equal(expected, first.AsQueryable().Zip(second.AsQueryable())); } @@ -62,14 +62,14 @@ public void Zip2_CorrectResults() public void Zip2_FirstIsNull() { IQueryable first = null; - int[] second = new int[] { 2, 5, 9 }; + int[] second = { 2, 5, 9 }; AssertExtensions.Throws("source1", () => first.Zip(second.AsQueryable())); } [Fact] public void Zip2_SecondIsNull() { - int[] first = new int[] { 1, 2, 3 }; + int[] first = { 1, 2, 3 }; IQueryable second = null; AssertExtensions.Throws("source2", () => first.AsQueryable().Zip(second)); } @@ -77,15 +77,15 @@ public void Zip2_SecondIsNull() [Fact] public void Zip2() { - int count = (new int[] { 0, 1, 2 }).AsQueryable().Zip((new int[] { 10, 11, 12 }).AsQueryable()).Count(); + int count = new[] { 0, 1, 2 }.AsQueryable().Zip(new[] { 10, 11, 12 }.AsQueryable()).Count(); Assert.Equal(3, count); } [Fact] public void TupleNames() { - int[] first = new int[] { 1 }; - int[] second = new int[] { 2 }; + int[] first = { 1 }; + int[] second = { 2 }; var tuple = first.AsQueryable().Zip(second.AsQueryable()).First(); Assert.Equal(tuple.Item1, tuple.First); Assert.Equal(tuple.Item2, tuple.Second); @@ -94,10 +94,10 @@ public void TupleNames() [Fact] public void Zip3_CorrectResults() { - int[] first = new int[] { 1, 3, 5 }; - int[] second = new int[] { 2, 6, 8 }; - int[] third = new int[] { 1, 7, 2 }; - var expected = new (int, int, int)[] { (1, 2, 1), (3, 6, 7), (5, 8, 2) }; + int[] first = { 1, 3, 5 }; + int[] second = { 2, 6, 8 }; + int[] third = { 1, 7, 2 }; + var expected = new[] { (1, 2, 1), (3, 6, 7), (5, 8, 2) }; Assert.Equal(expected, first.AsQueryable().Zip(second.AsQueryable(), third.AsQueryable())); } @@ -106,25 +106,25 @@ public void Zip3_CorrectResults() public void Zip3_FirstIsNull() { IQueryable first = null; - int[] second = new int[] { 2, 6, 8 }; - int[] third = new int[] { 1, 7, 2 }; + int[] second = { 2, 6, 8 }; + int[] third = { 1, 7, 2 }; AssertExtensions.Throws("source1", () => first.Zip(second.AsQueryable(), third.AsQueryable())); } [Fact] public void Zip3_SecondIsNull() { - int[] first = new int[] { 1, 3, 5 }; + int[] first = { 1, 3, 5 }; IQueryable second = null; - int[] third = new int[] { 1, 7, 2 }; + int[] third = { 1, 7, 2 }; AssertExtensions.Throws("source2", () => first.AsQueryable().Zip(second, third.AsQueryable())); } [Fact] public void Zip3_ThirdIsNull() { - int[] first = new int[] { 1, 3, 5 }; - int[] second = new int[] { 2, 6, 8 }; + int[] first = { 1, 3, 5 }; + int[] second = { 2, 6, 8 }; IQueryable third = null; AssertExtensions.Throws("source3", () => first.AsQueryable().Zip(second.AsQueryable(), third)); } @@ -132,9 +132,9 @@ public void Zip3_ThirdIsNull() [Fact] public void Zip3_TupleNames() { - int[] first = new int[] { 1 }; - int[] second = new int[] { 2 }; - int[] third = new int[] { 3 }; + int[] first = { 1 }; + int[] second = { 2 }; + int[] third = { 3 }; var tuple = first.AsQueryable().Zip(second.AsQueryable(), third.AsQueryable()).First(); Assert.Equal(tuple.Item1, tuple.First); Assert.Equal(tuple.Item2, tuple.Second);