Pointless change

This commit is contained in:
yangzhi 2019-05-13 22:41:26 +08:00
parent 8839cfe262
commit e2f8f88186
27 changed files with 361 additions and 233 deletions

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!-- Standard properties. -->
<PropertyGroup>
<Version Condition="'$(BUILD_BUILDNUMBER)' != ''">$(BUILD_BUILDNUMBER)</Version>
<OutputType Condition="'$(OutputType)' == ''">Library</OutputType>
<RootNamespace Condition="'$(RootNamespace)' == ''">$(AssemblyName)</RootNamespace>
<Configurations>Debug;Release;DebugLegacy;ReleaseLegacy</Configurations>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
<OutputPath>bin\$(Configuration)</OutputPath>
<LangVersion>7.3</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Externalconsole>true</Externalconsole>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Cecil Condition="'$(Cecil)' == ''">true</Cecil>
<CecilLegacy>false</CecilLegacy>
<ILGen Condition="'$(ILGen)' == ''">false</ILGen>
<NETFramework>false</NETFramework>
<NETStandard>false</NETStandard>
<NETStandard1X>false</NETStandard1X>
</PropertyGroup>
<!-- dotnet pack -->
<PropertyGroup>
<Authors>0x0ade</Authors> <!-- Note: This previously said "Maik Macho and collaborators", but with dotnet pack, <Authors> is also the list of owners. -->
<Copyright>Copyright 2018 Maik Macho</Copyright>
<PackageTags>MonoMod;assembly;assemblies;module;modules;il;cil;msil;bytecode;reflection;injection;cecil;mono;$(PackageTags)</PackageTags>
<PackageLicenseUrl>https://github.com/0x0ade/MonoMod/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/0x0ade/MonoMod</PackageProjectUrl>
<PackageIconUrl>https://user-images.githubusercontent.com/1200380/47308180-28242880-d631-11e8-89d2-14d86f3db113.png</PackageIconUrl>
<!-- Fix dotnet pack not being able to find .NET Framework 3.5 -->
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35' And '$(OS)' == 'Windows_NT'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
</PropertyGroup>
<!-- Debug -->
<PropertyGroup Condition="'$(Configuration)' == 'Debug' Or '$(Configuration)' == 'DebugLegacy'">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<!-- Release -->
<PropertyGroup Condition="'$(Configuration)' == 'Release' Or '$(Configuration)' == 'ReleaseLegacy'">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<!-- Legacy -->
<PropertyGroup Condition="'$(Configuration)' == 'DebugLegacy' Or '$(Configuration)' == 'ReleaseLegacy'">
<CecilLegacy>true</CecilLegacy>
</PropertyGroup>
<!-- Common references. -->
<Choose>
<When Condition="$(TargetFramework.StartsWith('netstandard')) Or $(TargetFramework.StartsWith('netcoreapp'))">
<!-- .NET Standard -->
<PropertyGroup>
<NETStandard>true</NETStandard>
<NETStandard1X Condition="$(TargetFramework.StartsWith('netstandard1')) Or $(TargetFramework.StartsWith('netcoreapp1'))">true</NETStandard1X>
<DefineConstants>NETSTANDARD;$(DefineConstants)</DefineConstants>
<DefineConstants Condition="$(NETStandard1X)">NETSTANDARD1_X;$(DefineConstants)</DefineConstants>
<DefineConstants Condition="$(CecilLegacy)">CECIL0_10;$(DefineConstants)</DefineConstants>
<CecilVersion Condition="$(CecilLegacy) And '$(CecilVersion)' == ''">0.10.3</CecilVersion>
</PropertyGroup>
<ItemGroup>
<!-- These are also required when targeting .NET Standard 2.0 to resolve a version conflict with Mono.Cecil, which targets .NET Standard 1.0 -->
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" />
<PackageReference Include="System.Collections.NonGeneric" Version="4.3.0" />
<PackageReference Include="System.ComponentModel.TypeConverter" Version="4.3.0" />
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
<PackageReference Include="System.Reflection.Emit.ILGeneration" Version="4.3.0" />
</ItemGroup>
</When>
<Otherwise>
<!-- .NET Framework -->
<PropertyGroup>
<NETFramework>true</NETFramework>
<DefineConstants>NETFRAMEWORK;$(DefineConstants)</DefineConstants>
<DefineConstants Condition="$(CecilLegacy)">CECIL0_9;$(DefineConstants)</DefineConstants>
<CecilVersion Condition="$(CecilLegacy) And '$(CecilVersion)' == ''">0.9.6</CecilVersion>
</PropertyGroup>
<ItemGroup>
<!-- <Reference Include="mscorlib" /> -->
<Reference Include="System" />
</ItemGroup>
</Otherwise>
</Choose>
<!-- Mono.Cecil reference. -->
<PropertyGroup>
<CecilVersion Condition="'$(CecilVersion)' == ''">0.10.3</CecilVersion>
</PropertyGroup>
<ItemGroup Condition="$(Cecil)">
<PackageReference Include="Mono.Cecil">
<Version>$(CecilVersion)</Version>
</PackageReference>
</ItemGroup>
<!-- Shared source files. -->
<ItemGroup >
<Compile Condition="'$(AssemblyName)' != 'MonoMod'" Include="..\MonoMod\Properties\AssemblyInfo.Common.cs">
<Link>AssemblyInfo.Common.cs</Link>
</Compile>
<Compile Condition="'$(AssemblyName)' != 'MonoMod.Utils'" Include="..\MonoMod.Utils\NETStandardShims.cs">
<Link>NETStandardShims.cs</Link>
</Compile>
</ItemGroup>
</Project>

View File

@ -58,7 +58,7 @@ namespace Newtonsoft.Json
/// To serialize without using any default settings create a <see cref="JsonSerializer"/> with
/// <see cref="JsonSerializer.Create()"/>.
/// </summary>
public static Serialization.Func<JsonSerializerSettings> DefaultSettings { get; set; }
public static Func<JsonSerializerSettings> DefaultSettings { get; set; }
/// <summary>
/// Represents JavaScript's boolean value <c>true</c> as a string. This field is read-only.

View File

@ -245,7 +245,7 @@ namespace Newtonsoft.Json
{
ReferenceResolverProvider = (value != null)
? () => value
: (Serialization.Func<IReferenceResolver>)null;
: (Func<IReferenceResolver>)null;
}
}
@ -253,7 +253,7 @@ namespace Newtonsoft.Json
/// Gets or sets a function that creates the <see cref="IReferenceResolver"/> used by the serializer when resolving references.
/// </summary>
/// <value>A function that creates the <see cref="IReferenceResolver"/> used by the serializer when resolving references.</value>
public Serialization.Func<IReferenceResolver> ReferenceResolverProvider { get; set; }
public Func<IReferenceResolver> ReferenceResolverProvider { get; set; }
/// <summary>
/// Gets or sets the <see cref="ITraceWriter"/> used by the serializer when writing trace messages.

View File

@ -349,7 +349,7 @@ namespace Newtonsoft.Json.Serialization
contract.MemberSerialization = JsonTypeReflector.GetObjectMemberSerialization(contract.NonNullableUnderlyingType, ignoreSerializableAttribute);
contract.Properties.AddRange(CreateProperties(contract.NonNullableUnderlyingType, contract.MemberSerialization));
Serialization.Func<string, string> extensionDataNameResolver = null;
Func<string, string> extensionDataNameResolver = null;
JsonObjectAttribute attribute = JsonTypeReflector.GetCachedAttribute<JsonObjectAttribute>(contract.NonNullableUnderlyingType);
if (attribute != null)
@ -511,14 +511,14 @@ namespace Newtonsoft.Json.Serialization
createdType = t;
}
Serialization.Func<object, object> getExtensionDataDictionary = JsonTypeReflector.ReflectionDelegateFactory.CreateGet<object>(member);
Func<object, object> getExtensionDataDictionary = JsonTypeReflector.ReflectionDelegateFactory.CreateGet<object>(member);
if (extensionDataAttribute.ReadData)
{
Serialization.Action<object, object> setExtensionDataDictionary = (ReflectionUtils.CanSetMemberValue(member, true, false))
Action<object, object> setExtensionDataDictionary = (ReflectionUtils.CanSetMemberValue(member, true, false))
? JsonTypeReflector.ReflectionDelegateFactory.CreateSet<object>(member)
: null;
Serialization.Func<object> createExtensionDataDictionary = JsonTypeReflector.ReflectionDelegateFactory.CreateDefaultConstructor<object>(createdType);
Func<object> createExtensionDataDictionary = JsonTypeReflector.ReflectionDelegateFactory.CreateDefaultConstructor<object>(createdType);
MethodInfo setMethod = t.GetProperty("Item", BindingFlags.Public | BindingFlags.Instance, null, valueType, new[] { keyType }, null)?.GetSetMethod();
if (setMethod == null)
{
@ -775,7 +775,7 @@ namespace Newtonsoft.Json.Serialization
return JsonTypeReflector.GetJsonConverter(objectType);
}
private Serialization.Func<object> GetDefaultCreator(Type createdType)
private Func<object> GetDefaultCreator(Type createdType)
{
return JsonTypeReflector.ReflectionDelegateFactory.CreateDefaultConstructor<object>(createdType);
}
@ -1397,14 +1397,14 @@ namespace Newtonsoft.Json.Serialization
IValueProvider valueProvider;
#if !(PORTABLE40 || PORTABLE || DOTNET || NETSTANDARD2_0)
//if (DynamicCodeGeneration)
//{
// valueProvider = new DynamicValueProvider(member);
//}
//else
//{
if (DynamicCodeGeneration)
{
valueProvider = new DynamicValueProvider(member);
}
else
{
valueProvider = new ReflectionValueProvider(member);
//}
}
#elif !(PORTABLE40)
valueProvider = new ExpressionValueProvider(member);
#else
@ -1652,7 +1652,7 @@ namespace Newtonsoft.Json.Serialization
return;
}
Serialization.Func<object, object> specifiedPropertyGet = JsonTypeReflector.ReflectionDelegateFactory.CreateGet<object>(specifiedMember);
Func<object, object> specifiedPropertyGet = JsonTypeReflector.ReflectionDelegateFactory.CreateGet<object>(specifiedMember);
property.GetIsSpecified = o => (bool)specifiedPropertyGet(o);

View File

@ -42,8 +42,8 @@ namespace Newtonsoft.Json.Serialization
public class DynamicValueProvider : IValueProvider
{
private readonly MemberInfo _memberInfo;
private Serialization.Func<object, object> _getter;
private Serialization.Action<object, object> _setter;
private Func<object, object> _getter;
private Action<object, object> _setter;
/// <summary>
/// Initializes a new instance of the <see cref="DynamicValueProvider"/> class.

View File

@ -43,8 +43,8 @@ namespace Newtonsoft.Json.Serialization
public class ExpressionValueProvider : IValueProvider
{
private readonly MemberInfo _memberInfo;
private Serialization.Func<object, object> _getter;
private Serialization.Action<object, object> _setter;
private Func<object, object> _getter;
private Action<object, object> _setter;
/// <summary>
/// Initializes a new instance of the <see cref="ExpressionValueProvider"/> class.

View File

@ -61,7 +61,7 @@ namespace Newtonsoft.Json.Serialization
private Type _genericWrapperType;
private ObjectConstructor<object> _genericWrapperCreator;
private Serialization.Func<object> _genericTemporaryCollectionCreator;
private Func<object> _genericTemporaryCollectionCreator;
internal bool IsArray { get; }
internal bool ShouldCreateWrapper { get; }

View File

@ -227,7 +227,7 @@ namespace Newtonsoft.Json.Serialization
/// Gets or sets the default creator method used to create the object.
/// </summary>
/// <value>The default creator method used to create the object.</value>
public Serialization.Func<object> DefaultCreator { get; set; }
public Func<object> DefaultCreator { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the default creator is non-public.

View File

@ -45,7 +45,7 @@ namespace Newtonsoft.Json.Serialization
/// Gets or sets the dictionary key resolver.
/// </summary>
/// <value>The dictionary key resolver.</value>
public Serialization.Func<string, string> DictionaryKeyResolver { get; set; }
public Func<string, string> DictionaryKeyResolver { get; set; }
/// <summary>
/// Gets the <see cref="System.Type"/> of the dictionary keys.
@ -66,7 +66,7 @@ namespace Newtonsoft.Json.Serialization
private Type _genericWrapperType;
private ObjectConstructor<object> _genericWrapperCreator;
private Serialization.Func<object> _genericTemporaryDictionaryCreator;
private Func<object> _genericTemporaryDictionaryCreator;
internal bool ShouldCreateWrapper { get; }

View File

@ -46,26 +46,26 @@ namespace Newtonsoft.Json.Serialization
/// Gets or sets the property name resolver.
/// </summary>
/// <value>The property name resolver.</value>
public Serialization.Func<string, string> PropertyNameResolver { get; set; }
public Func<string, string> PropertyNameResolver { get; set; }
private readonly ThreadSafeStore<string, CallSite<Serialization.Func<CallSite, object, object>>> _callSiteGetters =
new ThreadSafeStore<string, CallSite<Serialization.Func<CallSite, object, object>>>(CreateCallSiteGetter);
private readonly ThreadSafeStore<string, CallSite<Func<CallSite, object, object>>> _callSiteGetters =
new ThreadSafeStore<string, CallSite<Func<CallSite, object, object>>>(CreateCallSiteGetter);
private readonly ThreadSafeStore<string, CallSite<Serialization.Func<CallSite, object, object, object>>> _callSiteSetters =
new ThreadSafeStore<string, CallSite<Serialization.Func<CallSite, object, object, object>>>(CreateCallSiteSetter);
private readonly ThreadSafeStore<string, CallSite<Func<CallSite, object, object, object>>> _callSiteSetters =
new ThreadSafeStore<string, CallSite<Func<CallSite, object, object, object>>>(CreateCallSiteSetter);
private static CallSite<Serialization.Func<CallSite, object, object>> CreateCallSiteGetter(string name)
private static CallSite<Func<CallSite, object, object>> CreateCallSiteGetter(string name)
{
GetMemberBinder getMemberBinder = (GetMemberBinder)DynamicUtils.BinderWrapper.GetMember(name, typeof(DynamicUtils));
return CallSite<Serialization.Func<CallSite, object, object>>.Create(new NoThrowGetBinderMember(getMemberBinder));
return CallSite<Func<CallSite, object, object>>.Create(new NoThrowGetBinderMember(getMemberBinder));
}
private static CallSite<Serialization.Func<CallSite, object, object, object>> CreateCallSiteSetter(string name)
private static CallSite<Func<CallSite, object, object, object>> CreateCallSiteSetter(string name)
{
SetMemberBinder binder = (SetMemberBinder)DynamicUtils.BinderWrapper.SetMember(name, typeof(DynamicUtils));
return CallSite<Serialization.Func<CallSite, object, object, object>>.Create(new NoThrowSetBinderMember(binder));
return CallSite<Func<CallSite, object, object, object>>.Create(new NoThrowSetBinderMember(binder));
}
/// <summary>
@ -84,7 +84,7 @@ namespace Newtonsoft.Json.Serialization
{
ValidationUtils.ArgumentNotNull(dynamicProvider, nameof(dynamicProvider));
CallSite<Serialization.Func<CallSite, object, object>> callSite = _callSiteGetters.Get(name);
CallSite<Func<CallSite, object, object>> callSite = _callSiteGetters.Get(name);
object result = callSite.Target(callSite, dynamicProvider);
@ -104,7 +104,7 @@ namespace Newtonsoft.Json.Serialization
{
ValidationUtils.ArgumentNotNull(dynamicProvider, nameof(dynamicProvider));
CallSite<Serialization.Func<CallSite, object, object, object>> callSite = _callSiteSetters.Get(name);
CallSite<Func<CallSite, object, object, object>> callSite = _callSiteSetters.Get(name);
object result = callSite.Target(callSite, dynamicProvider, value);

View File

@ -124,7 +124,7 @@ namespace Newtonsoft.Json.Serialization
/// Gets or sets the extension data name resolver.
/// </summary>
/// <value>The extension data name resolver.</value>
public Serialization.Func<string, string> ExtensionDataNameResolver { get; set; }
public Func<string, string> ExtensionDataNameResolver { get; set; }
internal bool ExtensionDataIsJToken;
private bool? _hasRequiredOrDefaultValueProperties;

View File

@ -266,7 +266,7 @@ namespace Newtonsoft.Json.Serialization
/// Gets or sets an action used to set whether the property has been deserialized.
/// </summary>
/// <value>An action used to set whether the property has been deserialized.</value>
public Serialization.Action<object, object> SetIsSpecified { get; set; }
public Action<object, object> SetIsSpecified { get; set; }
/// <summary>
/// Returns a <see cref="String"/> that represents this instance.

View File

@ -58,8 +58,8 @@ namespace Newtonsoft.Json.Serialization
public const string ConcurrentDictionaryTypeName = "System.Collections.Concurrent.ConcurrentDictionary`2";
private static readonly ThreadSafeStore<Type, Serialization.Func<object[], object>> CreatorCache =
new ThreadSafeStore<Type, Serialization.Func<object[], object>>(GetCreator);
private static readonly ThreadSafeStore<Type, Func<object[], object>> CreatorCache =
new ThreadSafeStore<Type, Func<object[], object>>(GetCreator);
#if !(NET20 || DOTNET)
private static readonly ThreadSafeStore<Type, Type> AssociatedMetadataTypesCache = new ThreadSafeStore<Type, Type>(GetAssociateMetadataTypeFromAttribute);
@ -184,7 +184,7 @@ namespace Newtonsoft.Json.Serialization
if (converterAttribute != null)
{
Serialization.Func<object[], object> creator = CreatorCache.Get(converterAttribute.ConverterType);
Func<object[], object> creator = CreatorCache.Get(converterAttribute.ConverterType);
if (creator != null)
{
return (JsonConverter)creator(converterAttribute.ConverterParameters);
@ -202,13 +202,13 @@ namespace Newtonsoft.Json.Serialization
/// If <c>null</c>, the default constructor is used.</param>
public static JsonConverter CreateJsonConverterInstance(Type converterType, object[] args)
{
Serialization.Func<object[], object> converterCreator = CreatorCache.Get(converterType);
Func<object[], object> converterCreator = CreatorCache.Get(converterType);
return (JsonConverter)converterCreator(args);
}
public static NamingStrategy CreateNamingStrategyInstance(Type namingStrategyType, object[] args)
{
Serialization.Func<object[], object> converterCreator = CreatorCache.Get(namingStrategyType);
Func<object[], object> converterCreator = CreatorCache.Get(namingStrategyType);
return (NamingStrategy)converterCreator(args);
}
@ -227,9 +227,9 @@ namespace Newtonsoft.Json.Serialization
return containerAttribute.NamingStrategyInstance;
}
private static Serialization.Func<object[], object> GetCreator(Type type)
private static Func<object[], object> GetCreator(Type type)
{
Serialization.Func<object> defaultConstructor = (ReflectionUtils.HasDefaultConstructor(type, false))
Func<object> defaultConstructor = (ReflectionUtils.HasDefaultConstructor(type, false))
? ReflectionDelegateFactory.CreateDefaultConstructor<object>(type)
: null;
@ -516,10 +516,10 @@ namespace Newtonsoft.Json.Serialization
get
{
#if !(PORTABLE40 || PORTABLE || DOTNET || NETSTANDARD2_0)
//if (DynamicCodeGeneration)
//{
// return DynamicReflectionDelegateFactory.Instance;
//}
if (DynamicCodeGeneration)
{
return DynamicReflectionDelegateFactory.Instance;
}
return LateBoundReflectionDelegateFactory.Instance;
#else

View File

@ -211,7 +211,7 @@ namespace Newtonsoft.Json.Utilities
return allAdded;
}
public static int IndexOf<T>(this IEnumerable<T> collection, Serialization.Func<T, bool> predicate)
public static int IndexOf<T>(this IEnumerable<T> collection, Func<T, bool> predicate)
{
int index = 0;
foreach (T value in collection)

View File

@ -248,10 +248,10 @@ namespace Newtonsoft.Json.Utilities
#endif
}
private static readonly ThreadSafeStore<StructMultiKey<Type, Type>, Serialization.Func<object, object>> CastConverters =
new ThreadSafeStore<StructMultiKey<Type, Type>, Serialization.Func<object, object>>(CreateCastConverter);
private static readonly ThreadSafeStore<StructMultiKey<Type, Type>, Func<object, object>> CastConverters =
new ThreadSafeStore<StructMultiKey<Type, Type>, Func<object, object>>(CreateCastConverter);
private static Serialization.Func<object, object> CreateCastConverter(StructMultiKey<Type, Type> t)
private static Func<object, object> CreateCastConverter(StructMultiKey<Type, Type> t)
{
Type initialType = t.Value1;
Type targetType = t.Value2;
@ -599,7 +599,7 @@ namespace Newtonsoft.Json.Utilities
return value;
}
Serialization.Func<object, object> castConverter = CastConverters.Get(new StructMultiKey<Type, Type>(valueType, targetType));
Func<object, object> castConverter = CastConverters.Get(new StructMultiKey<Type, Type>(valueType, targetType));
if (castConverter != null)
{
return castConverter(value);

View File

@ -239,7 +239,7 @@ namespace Newtonsoft.Json.Utilities
generator.Return();
}
public override Serialization.Func<T> CreateDefaultConstructor<T>(Type type)
public override Func<T> CreateDefaultConstructor<T>(Type type)
{
DynamicMethod dynamicMethod = CreateDynamicMethod("Create" + type.FullName, typeof(T), ReflectionUtils.EmptyTypes, type);
dynamicMethod.InitLocals = true;
@ -247,7 +247,7 @@ namespace Newtonsoft.Json.Utilities
GenerateCreateDefaultConstructorIL(type, generator, typeof(T));
return (Serialization.Func<T>)dynamicMethod.CreateDelegate(typeof(Serialization.Func<T>));
return (Func<T>)dynamicMethod.CreateDelegate(typeof(Func<T>));
}
private void GenerateCreateDefaultConstructorIL(Type type, ILGenerator generator, Type delegateType)
@ -279,14 +279,14 @@ namespace Newtonsoft.Json.Utilities
generator.Return();
}
public override Serialization.Func<T, object> CreateGet<T>(PropertyInfo propertyInfo)
public override Func<T, object> CreateGet<T>(PropertyInfo propertyInfo)
{
DynamicMethod dynamicMethod = CreateDynamicMethod("Get" + propertyInfo.Name, typeof(object), new[] { typeof(T) }, propertyInfo.DeclaringType);
ILGenerator generator = dynamicMethod.GetILGenerator();
GenerateCreateGetPropertyIL(propertyInfo, generator);
return (Serialization.Func<T, object>)dynamicMethod.CreateDelegate(typeof(Serialization.Func<T, object>));
return (Func<T, object>)dynamicMethod.CreateDelegate(typeof(Func<T, object>));
}
private void GenerateCreateGetPropertyIL(PropertyInfo propertyInfo, ILGenerator generator)
@ -307,12 +307,12 @@ namespace Newtonsoft.Json.Utilities
generator.Return();
}
public override Serialization.Func<T, object> CreateGet<T>(FieldInfo fieldInfo)
public override Func<T, object> CreateGet<T>(FieldInfo fieldInfo)
{
if (fieldInfo.IsLiteral)
{
object constantValue = fieldInfo.GetValue(null);
Serialization.Func<T, object> getter = o => constantValue;
Func<T, object> getter = o => constantValue;
return getter;
}
@ -321,7 +321,7 @@ namespace Newtonsoft.Json.Utilities
GenerateCreateGetFieldIL(fieldInfo, generator);
return (Serialization.Func<T, object>)dynamicMethod.CreateDelegate(typeof(Serialization.Func<T, object>));
return (Func<T, object>)dynamicMethod.CreateDelegate(typeof(Func<T, object>));
}
private void GenerateCreateGetFieldIL(FieldInfo fieldInfo, ILGenerator generator)
@ -340,14 +340,14 @@ namespace Newtonsoft.Json.Utilities
generator.Return();
}
public override Serialization.Action<T, object> CreateSet<T>(FieldInfo fieldInfo)
public override Action<T, object> CreateSet<T>(FieldInfo fieldInfo)
{
DynamicMethod dynamicMethod = CreateDynamicMethod("Set" + fieldInfo.Name, null, new[] { typeof(T), typeof(object) }, fieldInfo.DeclaringType);
ILGenerator generator = dynamicMethod.GetILGenerator();
GenerateCreateSetFieldIL(fieldInfo, generator);
return (Serialization.Action<T, object>)dynamicMethod.CreateDelegate(typeof(Serialization.Action<T, object>));
return (Action<T, object>)dynamicMethod.CreateDelegate(typeof(Action<T, object>));
}
internal static void GenerateCreateSetFieldIL(FieldInfo fieldInfo, ILGenerator generator)
@ -372,14 +372,14 @@ namespace Newtonsoft.Json.Utilities
generator.Return();
}
public override Serialization.Action<T, object> CreateSet<T>(PropertyInfo propertyInfo)
public override Action<T, object> CreateSet<T>(PropertyInfo propertyInfo)
{
DynamicMethod dynamicMethod = CreateDynamicMethod("Set" + propertyInfo.Name, null, new[] { typeof(T), typeof(object) }, propertyInfo.DeclaringType);
ILGenerator generator = dynamicMethod.GetILGenerator();
GenerateCreateSetPropertyIL(propertyInfo, generator);
return (Serialization.Action<T, object>)dynamicMethod.CreateDelegate(typeof(Serialization.Action<T, object>));
return (Action<T, object>)dynamicMethod.CreateDelegate(typeof(Action<T, object>));
}
internal static void GenerateCreateSetPropertyIL(PropertyInfo propertyInfo, ILGenerator generator)

View File

@ -180,7 +180,7 @@ namespace Newtonsoft.Json.Utilities
return callExpression;
}
public override Serialization.Func<T> CreateDefaultConstructor<T>(Type type)
public override Func<T> CreateDefaultConstructor<T>(Type type)
{
ValidationUtils.ArgumentNotNull(type, "type");
@ -198,9 +198,9 @@ namespace Newtonsoft.Json.Utilities
expression = EnsureCastExpression(expression, resultType);
LambdaExpression lambdaExpression = Expression.Lambda(typeof(Serialization.Func<T>), expression);
LambdaExpression lambdaExpression = Expression.Lambda(typeof(Func<T>), expression);
Serialization.Func<T> compiled = (Serialization.Func<T>)lambdaExpression.Compile();
Func<T> compiled = (Func<T>)lambdaExpression.Compile();
return compiled;
}
catch
@ -211,7 +211,7 @@ namespace Newtonsoft.Json.Utilities
}
}
public override Serialization.Func<T, object> CreateGet<T>(PropertyInfo propertyInfo)
public override Func<T, object> CreateGet<T>(PropertyInfo propertyInfo)
{
ValidationUtils.ArgumentNotNull(propertyInfo, nameof(propertyInfo));
@ -236,13 +236,13 @@ namespace Newtonsoft.Json.Utilities
resultExpression = EnsureCastExpression(resultExpression, resultType);
LambdaExpression lambdaExpression = Expression.Lambda(typeof(Serialization.Func<T, object>), resultExpression, parameterExpression);
LambdaExpression lambdaExpression = Expression.Lambda(typeof(Func<T, object>), resultExpression, parameterExpression);
Serialization.Func<T, object> compiled = (Serialization.Func<T, object>)lambdaExpression.Compile();
Func<T, object> compiled = (Func<T, object>)lambdaExpression.Compile();
return compiled;
}
public override Serialization.Func<T, object> CreateGet<T>(FieldInfo fieldInfo)
public override Func<T, object> CreateGet<T>(FieldInfo fieldInfo)
{
ValidationUtils.ArgumentNotNull(fieldInfo, nameof(fieldInfo));
@ -262,11 +262,11 @@ namespace Newtonsoft.Json.Utilities
fieldExpression = EnsureCastExpression(fieldExpression, typeof(object));
Serialization.Func<T, object> compiled = Expression.Lambda<Serialization.Func<T, object>>(fieldExpression, sourceParameter).Compile();
Func<T, object> compiled = Expression.Lambda<Func<T, object>>(fieldExpression, sourceParameter).Compile();
return compiled;
}
public override Serialization.Action<T, object> CreateSet<T>(FieldInfo fieldInfo)
public override Action<T, object> CreateSet<T>(FieldInfo fieldInfo)
{
ValidationUtils.ArgumentNotNull(fieldInfo, nameof(fieldInfo));
@ -296,13 +296,13 @@ namespace Newtonsoft.Json.Utilities
BinaryExpression assignExpression = Expression.Assign(fieldExpression, valueExpression);
LambdaExpression lambdaExpression = Expression.Lambda(typeof(Serialization.Action<T, object>), assignExpression, sourceParameterExpression, valueParameterExpression);
LambdaExpression lambdaExpression = Expression.Lambda(typeof(Action<T, object>), assignExpression, sourceParameterExpression, valueParameterExpression);
Serialization.Action<T, object> compiled = (Serialization.Action<T, object>)lambdaExpression.Compile();
Action<T, object> compiled = (Action<T, object>)lambdaExpression.Compile();
return compiled;
}
public override Serialization.Action<T, object> CreateSet<T>(PropertyInfo propertyInfo)
public override Action<T, object> CreateSet<T>(PropertyInfo propertyInfo)
{
ValidationUtils.ArgumentNotNull(propertyInfo, nameof(propertyInfo));
@ -335,9 +335,9 @@ namespace Newtonsoft.Json.Utilities
setExpression = Expression.Call(readInstanceParameter, setMethod, readValueParameter);
}
LambdaExpression lambdaExpression = Expression.Lambda(typeof(Serialization.Action<T, object>), setExpression, instanceParameter, valueParameter);
LambdaExpression lambdaExpression = Expression.Lambda(typeof(Action<T, object>), setExpression, instanceParameter, valueParameter);
Serialization.Action<T, object> compiled = (Serialization.Action<T, object>)lambdaExpression.Compile();
Action<T, object> compiled = (Action<T, object>)lambdaExpression.Compile();
return compiled;
}

View File

@ -67,9 +67,9 @@ namespace Newtonsoft.Json.Utilities
public static MethodCall<object, object> PreComputeUnionTagReader { get; private set; }
public static MethodCall<object, object> PreComputeUnionReader { get; private set; }
public static MethodCall<object, object> PreComputeUnionConstructor { get; private set; }
public static Serialization.Func<object, object> GetUnionCaseInfoDeclaringType { get; private set; }
public static Serialization.Func<object, object> GetUnionCaseInfoName { get; private set; }
public static Serialization.Func<object, object> GetUnionCaseInfoTag { get; private set; }
public static Func<object, object> GetUnionCaseInfoDeclaringType { get; private set; }
public static Func<object, object> GetUnionCaseInfoName { get; private set; }
public static Func<object, object> GetUnionCaseInfoTag { get; private set; }
public static MethodCall<object, object> GetUnionCaseInfoFields { get; private set; }
public const string FSharpSetTypeName = "FSharpSet`1";

View File

@ -65,7 +65,7 @@ namespace Newtonsoft.Json.Utilities
return (o, a) => method.Invoke(o, a);
}
public override Serialization.Func<T> CreateDefaultConstructor<T>(Type type)
public override Func<T> CreateDefaultConstructor<T>(Type type)
{
ValidationUtils.ArgumentNotNull(type, nameof(type));
@ -79,28 +79,28 @@ namespace Newtonsoft.Json.Utilities
return () => (T)constructorInfo.Invoke(null);
}
public override Serialization.Func<T, object> CreateGet<T>(PropertyInfo propertyInfo)
public override Func<T, object> CreateGet<T>(PropertyInfo propertyInfo)
{
ValidationUtils.ArgumentNotNull(propertyInfo, nameof(propertyInfo));
return o => propertyInfo.GetValue(o, null);
}
public override Serialization.Func<T, object> CreateGet<T>(FieldInfo fieldInfo)
public override Func<T, object> CreateGet<T>(FieldInfo fieldInfo)
{
ValidationUtils.ArgumentNotNull(fieldInfo, nameof(fieldInfo));
return o => fieldInfo.GetValue(o);
}
public override Serialization.Action<T, object> CreateSet<T>(FieldInfo fieldInfo)
public override Action<T, object> CreateSet<T>(FieldInfo fieldInfo)
{
ValidationUtils.ArgumentNotNull(fieldInfo, nameof(fieldInfo));
return (o, v) => fieldInfo.SetValue(o, v);
}
public override Serialization.Action<T, object> CreateSet<T>(PropertyInfo propertyInfo)
public override Action<T, object> CreateSet<T>(PropertyInfo propertyInfo)
{
ValidationUtils.ArgumentNotNull(propertyInfo, nameof(propertyInfo));

View File

@ -156,7 +156,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TSource> Where<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, bool> predicate)
Func<TSource, bool> predicate)
{
CheckNotNull(source, "source");
CheckNotNull(predicate, "predicate");
@ -166,7 +166,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private static IEnumerable<TSource> WhereYield<TSource>(
IEnumerable<TSource> source,
Serialization.Func<TSource, bool> predicate)
Func<TSource, bool> predicate)
{
foreach (var item in source)
if (predicate(item))
@ -179,7 +179,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TSource> Where<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, int, bool> predicate)
Func<TSource, int, bool> predicate)
{
CheckNotNull(source, "source");
CheckNotNull(predicate, "predicate");
@ -189,7 +189,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private static IEnumerable<TSource> WhereYield<TSource>(
IEnumerable<TSource> source,
Serialization.Func<TSource, int, bool> predicate)
Func<TSource, int, bool> predicate)
{
var i = 0;
foreach (var item in source)
@ -203,7 +203,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TResult> Select<TSource, TResult>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TResult> selector)
Func<TSource, TResult> selector)
{
CheckNotNull(source, "source");
CheckNotNull(selector, "selector");
@ -213,7 +213,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private static IEnumerable<TResult> SelectYield<TSource, TResult>(
IEnumerable<TSource> source,
Serialization.Func<TSource, TResult> selector)
Func<TSource, TResult> selector)
{
foreach (var item in source)
yield return selector(item);
@ -226,7 +226,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TResult> Select<TSource, TResult>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, int, TResult> selector)
Func<TSource, int, TResult> selector)
{
CheckNotNull(source, "source");
CheckNotNull(selector, "selector");
@ -236,7 +236,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private static IEnumerable<TResult> SelectYield<TSource, TResult>(
IEnumerable<TSource> source,
Serialization.Func<TSource, int, TResult> selector)
Func<TSource, int, TResult> selector)
{
var i = 0;
foreach (var item in source)
@ -250,7 +250,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TResult> SelectMany<TSource, TResult>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, IEnumerable<TResult>> selector)
Func<TSource, IEnumerable<TResult>> selector)
{
CheckNotNull(selector, "selector");
@ -266,7 +266,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TResult> SelectMany<TSource, TResult>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, int, IEnumerable<TResult>> selector)
Func<TSource, int, IEnumerable<TResult>> selector)
{
CheckNotNull(selector, "selector");
@ -281,8 +281,8 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TResult> SelectMany<TSource, TCollection, TResult>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, IEnumerable<TCollection>> collectionSelector,
Serialization.Func<TSource, TCollection, TResult> resultSelector)
Func<TSource, IEnumerable<TCollection>> collectionSelector,
Func<TSource, TCollection, TResult> resultSelector)
{
CheckNotNull(collectionSelector, "collectionSelector");
@ -299,8 +299,8 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TResult> SelectMany<TSource, TCollection, TResult>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, int, IEnumerable<TCollection>> collectionSelector,
Serialization.Func<TSource, TCollection, TResult> resultSelector)
Func<TSource, int, IEnumerable<TCollection>> collectionSelector,
Func<TSource, TCollection, TResult> resultSelector)
{
CheckNotNull(source, "source");
CheckNotNull(collectionSelector, "collectionSelector");
@ -311,8 +311,8 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private static IEnumerable<TResult> SelectManyYield<TSource, TCollection, TResult>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, int, IEnumerable<TCollection>> collectionSelector,
Serialization.Func<TSource, TCollection, TResult> resultSelector)
Func<TSource, int, IEnumerable<TCollection>> collectionSelector,
Func<TSource, TCollection, TResult> resultSelector)
{
var i = 0;
foreach (var item in source)
@ -326,7 +326,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TSource> TakeWhile<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, bool> predicate)
Func<TSource, bool> predicate)
{
CheckNotNull(predicate, "predicate");
@ -340,7 +340,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TSource> TakeWhile<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, int, bool> predicate)
Func<TSource, int, bool> predicate)
{
CheckNotNull(source, "source");
CheckNotNull(predicate, "predicate");
@ -350,7 +350,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private static IEnumerable<TSource> TakeWhileYield<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, int, bool> predicate)
Func<TSource, int, bool> predicate)
{
var i = 0;
foreach (var item in source)
@ -362,8 +362,8 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private static class Futures<T>
{
public static readonly Serialization.Func<T> Default = () => default(T);
public static readonly Serialization.Func<T> Undefined = () => { throw new InvalidOperationException(); };
public static readonly Func<T> Default = () => default(T);
public static readonly Func<T> Undefined = () => { throw new InvalidOperationException(); };
}
/// <summary>
@ -372,7 +372,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private static TSource FirstImpl<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource> empty)
Func<TSource> empty)
{
CheckNotNull(source, "source");
Debug.Assert(empty != null);
@ -401,7 +401,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static TSource First<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, bool> predicate)
Func<TSource, bool> predicate)
{
return First(source.Where(predicate));
}
@ -424,7 +424,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static TSource FirstOrDefault<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, bool> predicate)
Func<TSource, bool> predicate)
{
return FirstOrDefault(source.Where(predicate));
}
@ -435,7 +435,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private static TSource LastImpl<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource> empty)
Func<TSource> empty)
{
CheckNotNull(source, "source");
@ -472,7 +472,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static TSource Last<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, bool> predicate)
Func<TSource, bool> predicate)
{
return Last(source.Where(predicate));
}
@ -495,7 +495,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static TSource LastOrDefault<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, bool> predicate)
Func<TSource, bool> predicate)
{
return LastOrDefault(source.Where(predicate));
}
@ -506,7 +506,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private static TSource SingleImpl<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource> empty)
Func<TSource> empty)
{
CheckNotNull(source, "source");
@ -544,7 +544,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static TSource Single<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, bool> predicate)
Func<TSource, bool> predicate)
{
return Single(source.Where(predicate));
}
@ -570,7 +570,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static TSource SingleOrDefault<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, bool> predicate)
Func<TSource, bool> predicate)
{
return SingleOrDefault(source.Where(predicate));
}
@ -674,7 +674,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TSource> SkipWhile<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, bool> predicate)
Func<TSource, bool> predicate)
{
CheckNotNull(predicate, "predicate");
@ -689,7 +689,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TSource> SkipWhile<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, int, bool> predicate)
Func<TSource, int, bool> predicate)
{
CheckNotNull(source, "source");
CheckNotNull(predicate, "predicate");
@ -699,7 +699,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private static IEnumerable<TSource> SkipWhileYield<TSource>(
IEnumerable<TSource> source,
Serialization.Func<TSource, int, bool> predicate)
Func<TSource, int, bool> predicate)
{
using (var e = source.GetEnumerator())
{
@ -753,7 +753,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static int Count<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, bool> predicate)
Func<TSource, bool> predicate)
{
return Count(source.Where(predicate));
}
@ -781,7 +781,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static long LongCount<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, bool> predicate)
Func<TSource, bool> predicate)
{
return LongCount(source.Where(predicate));
}
@ -900,7 +900,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static ILookup<TKey, TSource> ToLookup<TSource, TKey>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector)
Func<TSource, TKey> keySelector)
{
return ToLookup(source, keySelector, e => e, /* comparer */ null);
}
@ -913,7 +913,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static ILookup<TKey, TSource> ToLookup<TSource, TKey>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Func<TSource, TKey> keySelector,
IEqualityComparer<TKey> comparer)
{
return ToLookup(source, keySelector, e => e, comparer);
@ -927,8 +927,8 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static ILookup<TKey, TElement> ToLookup<TSource, TKey, TElement>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Serialization.Func<TSource, TElement> elementSelector)
Func<TSource, TKey> keySelector,
Func<TSource, TElement> elementSelector)
{
return ToLookup(source, keySelector, elementSelector, /* comparer */ null);
}
@ -941,8 +941,8 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static ILookup<TKey, TElement> ToLookup<TSource, TKey, TElement>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Serialization.Func<TSource, TElement> elementSelector,
Func<TSource, TKey> keySelector,
Func<TSource, TElement> elementSelector,
IEqualityComparer<TKey> comparer)
{
CheckNotNull(source, "source");
@ -975,7 +975,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector)
Func<TSource, TKey> keySelector)
{
return GroupBy(source, keySelector, /* comparer */ null);
}
@ -988,7 +988,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Func<TSource, TKey> keySelector,
IEqualityComparer<TKey> comparer)
{
return GroupBy(source, keySelector, e => e, comparer);
@ -1002,8 +1002,8 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Serialization.Func<TSource, TElement> elementSelector)
Func<TSource, TKey> keySelector,
Func<TSource, TElement> elementSelector)
{
return GroupBy(source, keySelector, elementSelector, /* comparer */ null);
}
@ -1016,8 +1016,8 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Serialization.Func<TSource, TElement> elementSelector,
Func<TSource, TKey> keySelector,
Func<TSource, TElement> elementSelector,
IEqualityComparer<TKey> comparer)
{
CheckNotNull(source, "source");
@ -1035,8 +1035,8 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TResult> GroupBy<TSource, TKey, TResult>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Serialization.Func<TKey, IEnumerable<TSource>, TResult> resultSelector)
Func<TSource, TKey> keySelector,
Func<TKey, IEnumerable<TSource>, TResult> resultSelector)
{
return GroupBy(source, keySelector, resultSelector, /* comparer */ null);
}
@ -1050,8 +1050,8 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TResult> GroupBy<TSource, TKey, TResult>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Serialization.Func<TKey, IEnumerable<TSource>, TResult> resultSelector,
Func<TSource, TKey> keySelector,
Func<TKey, IEnumerable<TSource>, TResult> resultSelector,
IEqualityComparer<TKey> comparer)
{
CheckNotNull(source, "source");
@ -1069,9 +1069,9 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TResult> GroupBy<TSource, TKey, TElement, TResult>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Serialization.Func<TSource, TElement> elementSelector,
Serialization.Func<TKey, IEnumerable<TElement>, TResult> resultSelector)
Func<TSource, TKey> keySelector,
Func<TSource, TElement> elementSelector,
Func<TKey, IEnumerable<TElement>, TResult> resultSelector)
{
return GroupBy(source, keySelector, elementSelector, resultSelector, /* comparer */ null);
}
@ -1086,9 +1086,9 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TResult> GroupBy<TSource, TKey, TElement, TResult>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Serialization.Func<TSource, TElement> elementSelector,
Serialization.Func<TKey, IEnumerable<TElement>, TResult> resultSelector,
Func<TSource, TKey> keySelector,
Func<TSource, TElement> elementSelector,
Func<TKey, IEnumerable<TElement>, TResult> resultSelector,
IEqualityComparer<TKey> comparer)
{
CheckNotNull(source, "source");
@ -1106,7 +1106,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static TSource Aggregate<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TSource, TSource> func)
Func<TSource, TSource, TSource> func)
{
CheckNotNull(source, "source");
CheckNotNull(func, "func");
@ -1128,7 +1128,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static TAccumulate Aggregate<TSource, TAccumulate>(
this IEnumerable<TSource> source,
TAccumulate seed,
Serialization.Func<TAccumulate, TSource, TAccumulate> func)
Func<TAccumulate, TSource, TAccumulate> func)
{
return Aggregate(source, seed, func, r => r);
}
@ -1142,8 +1142,8 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static TResult Aggregate<TSource, TAccumulate, TResult>(
this IEnumerable<TSource> source,
TAccumulate seed,
Serialization.Func<TAccumulate, TSource, TAccumulate> func,
Serialization.Func<TAccumulate, TResult> resultSelector)
Func<TAccumulate, TSource, TAccumulate> func,
Func<TAccumulate, TResult> resultSelector)
{
CheckNotNull(source, "source");
CheckNotNull(func, "func");
@ -1230,7 +1230,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static bool All<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, bool> predicate)
Func<TSource, bool> predicate)
{
CheckNotNull(source, "source");
CheckNotNull(predicate, "predicate");
@ -1262,7 +1262,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static bool Any<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, bool> predicate)
Func<TSource, bool> predicate)
{
foreach (TSource item in source)
{
@ -1359,7 +1359,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private static TSource MinMaxImpl<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TSource, bool> lesser)
Func<TSource, TSource, bool> lesser)
{
CheckNotNull(source, "source");
Debug.Assert(lesser != null);
@ -1373,7 +1373,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private static TSource? MinMaxImpl<TSource>(
this IEnumerable<TSource?> source,
TSource? seed, Serialization.Func<TSource?, TSource?, bool> lesser) where TSource : struct
TSource? seed, Func<TSource?, TSource?, bool> lesser) where TSource : struct
{
CheckNotNull(source, "source");
Debug.Assert(lesser != null);
@ -1400,7 +1400,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static TResult Min<TSource, TResult>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TResult> selector)
Func<TSource, TResult> selector)
{
return source.Select(selector).Min();
}
@ -1423,7 +1423,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static TResult Max<TSource, TResult>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TResult> selector)
Func<TSource, TResult> selector)
{
return source.Select(selector).Max();
}
@ -1454,7 +1454,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IOrderedEnumerable<TSource> OrderBy<TSource, TKey>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector)
Func<TSource, TKey> keySelector)
{
return source.OrderBy(keySelector, /* comparer */ null);
}
@ -1466,7 +1466,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IOrderedEnumerable<TSource> OrderBy<TSource, TKey>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Func<TSource, TKey> keySelector,
IComparer<TKey> comparer)
{
CheckNotNull(source, "source");
@ -1481,7 +1481,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IOrderedEnumerable<TSource> OrderByDescending<TSource, TKey>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector)
Func<TSource, TKey> keySelector)
{
return source.OrderByDescending(keySelector, /* comparer */ null);
}
@ -1493,7 +1493,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IOrderedEnumerable<TSource> OrderByDescending<TSource, TKey>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Func<TSource, TKey> keySelector,
IComparer<TKey> comparer)
{
CheckNotNull(source, "source");
@ -1509,7 +1509,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IOrderedEnumerable<TSource> ThenBy<TSource, TKey>(
this IOrderedEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector)
Func<TSource, TKey> keySelector)
{
return source.ThenBy(keySelector, /* comparer */ null);
}
@ -1521,7 +1521,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IOrderedEnumerable<TSource> ThenBy<TSource, TKey>(
this IOrderedEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Func<TSource, TKey> keySelector,
IComparer<TKey> comparer)
{
CheckNotNull(source, "source");
@ -1536,7 +1536,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IOrderedEnumerable<TSource> ThenByDescending<TSource, TKey>(
this IOrderedEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector)
Func<TSource, TKey> keySelector)
{
return source.ThenByDescending(keySelector, /* comparer */ null);
}
@ -1548,7 +1548,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IOrderedEnumerable<TSource> ThenByDescending<TSource, TKey>(
this IOrderedEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Func<TSource, TKey> keySelector,
IComparer<TKey> comparer)
{
CheckNotNull(source, "source");
@ -1647,7 +1647,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static Dictionary<TKey, TSource> ToDictionary<TSource, TKey>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector)
Func<TSource, TKey> keySelector)
{
return source.ToDictionary(keySelector, /* comparer */ null);
}
@ -1660,7 +1660,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static Dictionary<TKey, TSource> ToDictionary<TSource, TKey>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Func<TSource, TKey> keySelector,
IEqualityComparer<TKey> comparer)
{
return source.ToDictionary(keySelector, e => e);
@ -1674,8 +1674,8 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static Dictionary<TKey, TElement> ToDictionary<TSource, TKey, TElement>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Serialization.Func<TSource, TElement> elementSelector)
Func<TSource, TKey> keySelector,
Func<TSource, TElement> elementSelector)
{
return source.ToDictionary(keySelector, elementSelector, /* comparer */ null);
}
@ -1688,8 +1688,8 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static Dictionary<TKey, TElement> ToDictionary<TSource, TKey, TElement>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, TKey> keySelector,
Serialization.Func<TSource, TElement> elementSelector,
Func<TSource, TKey> keySelector,
Func<TSource, TElement> elementSelector,
IEqualityComparer<TKey> comparer)
{
CheckNotNull(source, "source");
@ -1726,9 +1726,9 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TResult> Join<TOuter, TInner, TKey, TResult>(
this IEnumerable<TOuter> outer,
IEnumerable<TInner> inner,
Serialization.Func<TOuter, TKey> outerKeySelector,
Serialization.Func<TInner, TKey> innerKeySelector,
Serialization.Func<TOuter, TInner, TResult> resultSelector)
Func<TOuter, TKey> outerKeySelector,
Func<TInner, TKey> innerKeySelector,
Func<TOuter, TInner, TResult> resultSelector)
{
return outer.Join(inner, outerKeySelector, innerKeySelector, resultSelector, /* comparer */ null);
}
@ -1742,9 +1742,9 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TResult> Join<TOuter, TInner, TKey, TResult>(
this IEnumerable<TOuter> outer,
IEnumerable<TInner> inner,
Serialization.Func<TOuter, TKey> outerKeySelector,
Serialization.Func<TInner, TKey> innerKeySelector,
Serialization.Func<TOuter, TInner, TResult> resultSelector,
Func<TOuter, TKey> outerKeySelector,
Func<TInner, TKey> innerKeySelector,
Func<TOuter, TInner, TResult> resultSelector,
IEqualityComparer<TKey> comparer)
{
CheckNotNull(outer, "outer");
@ -1770,9 +1770,9 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(
this IEnumerable<TOuter> outer,
IEnumerable<TInner> inner,
Serialization.Func<TOuter, TKey> outerKeySelector,
Serialization.Func<TInner, TKey> innerKeySelector,
Serialization.Func<TOuter, IEnumerable<TInner>, TResult> resultSelector)
Func<TOuter, TKey> outerKeySelector,
Func<TInner, TKey> innerKeySelector,
Func<TOuter, IEnumerable<TInner>, TResult> resultSelector)
{
return outer.GroupJoin(inner, outerKeySelector, innerKeySelector, resultSelector, /* comparer */ null);
}
@ -1787,9 +1787,9 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static IEnumerable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(
this IEnumerable<TOuter> outer,
IEnumerable<TInner> inner,
Serialization.Func<TOuter, TKey> outerKeySelector,
Serialization.Func<TInner, TKey> innerKeySelector,
Serialization.Func<TOuter, IEnumerable<TInner>, TResult> resultSelector,
Func<TOuter, TKey> outerKeySelector,
Func<TInner, TKey> innerKeySelector,
Func<TOuter, IEnumerable<TInner>, TResult> resultSelector,
IEqualityComparer<TKey> comparer)
{
CheckNotNull(outer, "outer");
@ -1851,7 +1851,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static int Sum<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, int> selector)
Func<TSource, int> selector)
{
return source.Select(selector).Sum();
}
@ -1889,7 +1889,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static double Average<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, int> selector)
Func<TSource, int> selector)
{
return source.Select(selector).Average();
}
@ -1919,7 +1919,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static int? Sum<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, int?> selector)
Func<TSource, int?> selector)
{
return source.Select(selector).Sum();
}
@ -1957,7 +1957,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static double? Average<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, int?> selector)
Func<TSource, int?> selector)
{
return source.Select(selector).Average();
}
@ -1982,7 +1982,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static int? Min<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, int?> selector)
Func<TSource, int?> selector)
{
return source.Select(selector).Min();
}
@ -2008,7 +2008,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static int? Max<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, int?> selector)
Func<TSource, int?> selector)
{
return source.Select(selector).Max();
}
@ -2037,7 +2037,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static long Sum<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, long> selector)
Func<TSource, long> selector)
{
return source.Select(selector).Sum();
}
@ -2075,7 +2075,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static double Average<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, long> selector)
Func<TSource, long> selector)
{
return source.Select(selector).Average();
}
@ -2105,7 +2105,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static long? Sum<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, long?> selector)
Func<TSource, long?> selector)
{
return source.Select(selector).Sum();
}
@ -2143,7 +2143,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static double? Average<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, long?> selector)
Func<TSource, long?> selector)
{
return source.Select(selector).Average();
}
@ -2168,7 +2168,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static long? Min<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, long?> selector)
Func<TSource, long?> selector)
{
return source.Select(selector).Min();
}
@ -2194,7 +2194,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static long? Max<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, long?> selector)
Func<TSource, long?> selector)
{
return source.Select(selector).Max();
}
@ -2223,7 +2223,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static float Sum<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, float> selector)
Func<TSource, float> selector)
{
return source.Select(selector).Sum();
}
@ -2261,7 +2261,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static float Average<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, float> selector)
Func<TSource, float> selector)
{
return source.Select(selector).Average();
}
@ -2291,7 +2291,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static float? Sum<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, float?> selector)
Func<TSource, float?> selector)
{
return source.Select(selector).Sum();
}
@ -2329,7 +2329,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static float? Average<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, float?> selector)
Func<TSource, float?> selector)
{
return source.Select(selector).Average();
}
@ -2354,7 +2354,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static float? Min<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, float?> selector)
Func<TSource, float?> selector)
{
return source.Select(selector).Min();
}
@ -2380,7 +2380,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static float? Max<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, float?> selector)
Func<TSource, float?> selector)
{
return source.Select(selector).Max();
}
@ -2409,7 +2409,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static double Sum<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, double> selector)
Func<TSource, double> selector)
{
return source.Select(selector).Sum();
}
@ -2447,7 +2447,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static double Average<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, double> selector)
Func<TSource, double> selector)
{
return source.Select(selector).Average();
}
@ -2477,7 +2477,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static double? Sum<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, double?> selector)
Func<TSource, double?> selector)
{
return source.Select(selector).Sum();
}
@ -2515,7 +2515,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static double? Average<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, double?> selector)
Func<TSource, double?> selector)
{
return source.Select(selector).Average();
}
@ -2540,7 +2540,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static double? Min<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, double?> selector)
Func<TSource, double?> selector)
{
return source.Select(selector).Min();
}
@ -2566,7 +2566,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static double? Max<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, double?> selector)
Func<TSource, double?> selector)
{
return source.Select(selector).Max();
}
@ -2595,7 +2595,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static decimal Sum<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, decimal> selector)
Func<TSource, decimal> selector)
{
CheckNotNull(source, "source");
CheckNotNull(selector, "selector");
@ -2642,7 +2642,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static decimal Average<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, decimal> selector)
Func<TSource, decimal> selector)
{
return source.Select(selector).Average();
}
@ -2672,7 +2672,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static decimal? Sum<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, decimal?> selector)
Func<TSource, decimal?> selector)
{
return source.Select(selector).Sum();
}
@ -2710,7 +2710,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static decimal? Average<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, decimal?> selector)
Func<TSource, decimal?> selector)
{
return source.Select(selector).Average();
}
@ -2735,7 +2735,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static decimal? Min<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, decimal?> selector)
Func<TSource, decimal?> selector)
{
return source.Select(selector).Min();
}
@ -2761,7 +2761,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
public static decimal? Max<TSource>(
this IEnumerable<TSource> source,
Serialization.Func<TSource, decimal?> selector)
Func<TSource, decimal?> selector)
{
return source.Select(selector).Max();
}
@ -2802,7 +2802,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
/// </summary>
IOrderedEnumerable<TElement> CreateOrderedEnumerable<TKey>(
Serialization.Func<TElement, TKey> keySelector, IComparer<TKey> comparer, bool descending);
Func<TElement, TKey> keySelector, IComparer<TKey> comparer, bool descending);
}
/// <summary>
@ -2862,7 +2862,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
/// </summary>
public IEnumerable<TResult> ApplyResultSelector<TResult>(
Serialization.Func<TKey, IEnumerable<TElement>, TResult> resultSelector)
Func<TKey, IEnumerable<TElement>, TResult> resultSelector)
{
if (resultSelector == null)
throw new ArgumentNullException("resultSelector");
@ -2892,13 +2892,13 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
private readonly List<Comparison<T>> _comparisons;
public OrderedEnumerable(IEnumerable<T> source,
Serialization.Func<T, K> keySelector, IComparer<K> comparer, bool descending) :
Func<T, K> keySelector, IComparer<K> comparer, bool descending) :
this(source, null, keySelector, comparer, descending)
{
}
private OrderedEnumerable(IEnumerable<T> source, List<Comparison<T>> comparisons,
Serialization.Func<T, K> keySelector, IComparer<K> comparer, bool descending)
Func<T, K> keySelector, IComparer<K> comparer, bool descending)
{
if (source == null) throw new ArgumentNullException("source");
if (keySelector == null) throw new ArgumentNullException("keySelector");
@ -2917,7 +2917,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
}
public IOrderedEnumerable<T> CreateOrderedEnumerable<KK>(
Serialization.Func<T, KK> keySelector, IComparer<KK> comparer, bool descending)
Func<T, KK> keySelector, IComparer<KK> comparer, bool descending)
{
return new OrderedEnumerable<T, KK>(_source, _comparisons, keySelector, comparer, descending);
}
@ -2934,7 +2934,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
// thus making the sort stable.
//
var list = _source.Select(new Serialization.Func<T, int, Tuple<T, int>>(TagPosition)).ToList();
var list = _source.Select(new Func<T, int, Tuple<T, int>>(TagPosition)).ToList();
list.Sort((x, y) =>
{
@ -2958,7 +2958,7 @@ namespace Newtonsoft.Json.Utilities.LinqBridge
return x.Second.CompareTo(y.Second);
});
return list.Select(new Serialization.Func<Tuple<T, int>, T>(GetFirst)).GetEnumerator();
return list.Select(new Func<Tuple<T, int>, T>(GetFirst)).GetEnumerator();
}

View File

@ -36,7 +36,7 @@ namespace Newtonsoft.Json.Utilities
{
internal abstract class ReflectionDelegateFactory
{
public Serialization.Func<T, object> CreateGet<T>(MemberInfo memberInfo)
public Func<T, object> CreateGet<T>(MemberInfo memberInfo)
{
if (memberInfo is PropertyInfo propertyInfo)
{
@ -57,7 +57,7 @@ namespace Newtonsoft.Json.Utilities
throw new Exception("Could not create getter for {0}.".FormatWith(CultureInfo.InvariantCulture, memberInfo));
}
public Serialization.Action<T, object> CreateSet<T>(MemberInfo memberInfo)
public Action<T, object> CreateSet<T>(MemberInfo memberInfo)
{
if (memberInfo is PropertyInfo propertyInfo)
{
@ -74,10 +74,10 @@ namespace Newtonsoft.Json.Utilities
public abstract MethodCall<T, object> CreateMethodCall<T>(MethodBase method);
public abstract ObjectConstructor<object> CreateParameterizedConstructor(MethodBase method);
public abstract Serialization.Func<T> CreateDefaultConstructor<T>(Type type);
public abstract Serialization.Func<T, object> CreateGet<T>(PropertyInfo propertyInfo);
public abstract Serialization.Func<T, object> CreateGet<T>(FieldInfo fieldInfo);
public abstract Serialization.Action<T, object> CreateSet<T>(FieldInfo fieldInfo);
public abstract Serialization.Action<T, object> CreateSet<T>(PropertyInfo propertyInfo);
public abstract Func<T> CreateDefaultConstructor<T>(Type type);
public abstract Func<T, object> CreateGet<T>(PropertyInfo propertyInfo);
public abstract Func<T, object> CreateGet<T>(FieldInfo fieldInfo);
public abstract Action<T, object> CreateSet<T>(FieldInfo fieldInfo);
public abstract Action<T, object> CreateSet<T>(PropertyInfo propertyInfo);
}
}

View File

@ -40,8 +40,8 @@ namespace Newtonsoft.Json.Utilities
internal class ReflectionMember
{
public Type MemberType { get; set; }
public Serialization.Func<object, object> Getter { get; set; }
public Serialization.Action<object, object> Setter { get; set; }
public Func<object, object> Getter { get; set; }
public Action<object, object> Setter { get; set; }
}
internal class ReflectionObject
@ -57,13 +57,13 @@ namespace Newtonsoft.Json.Utilities
public object GetValue(object target, string member)
{
Serialization.Func<object, object> getter = Members[member].Getter;
Func<object, object> getter = Members[member].Getter;
return getter(target);
}
public void SetValue(object target, string member, object value)
{
Serialization.Action<object, object> setter = Members[member].Setter;
Action<object, object> setter = Members[member].Setter;
setter(target, value);
}
@ -90,7 +90,7 @@ namespace Newtonsoft.Json.Utilities
{
if (ReflectionUtils.HasDefaultConstructor(t, false))
{
Serialization.Func<object> ctor = delegateFactory.CreateDefaultConstructor<object>(t);
Func<object> ctor = delegateFactory.CreateDefaultConstructor<object>(t);
creatorConstructor = args => ctor();
}

View File

@ -41,7 +41,7 @@ using Newtonsoft.Json.Serialization;
namespace Newtonsoft.Json.Utilities
{
#if (DOTNET || PORTABLE || PORTABLE40) && !NETSTANDARD2_0
#if (DOTNET || PORTABLE) && !NETSTANDARD2_0
[Flags]
internal enum MemberTypes
{

View File

@ -122,7 +122,7 @@ namespace Newtonsoft.Json.Utilities
buffer[5] = MathUtils.IntToHex(c & '\x000f');
}
public static TSource ForgivingCaseSensitiveFind<TSource>(this IEnumerable<TSource> source, Serialization.Func<TSource, string> valueSelector, string testValue)
public static TSource ForgivingCaseSensitiveFind<TSource>(this IEnumerable<TSource> source, Func<TSource, string> valueSelector, string testValue)
{
if (source == null)
{

View File

@ -44,9 +44,9 @@ namespace Newtonsoft.Json.Utilities
private readonly object _lock = new object();
private Dictionary<TKey, TValue> _store;
#endif
private readonly Serialization.Func<TKey, TValue> _creator;
private readonly Func<TKey, TValue> _creator;
public ThreadSafeStore(Serialization.Func<TKey, TValue> creator)
public ThreadSafeStore(Func<TKey, TValue> creator)
{
ValidationUtils.ArgumentNotNull(creator, nameof(creator));

View File

@ -1,6 +1,8 @@
using System.Reflection;
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
@ -34,3 +36,5 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AllowPartiallyTrustedCallers]

BIN
src/UpgradeLog.htm Normal file

Binary file not shown.