RSCG – FastGenericNew

RSCG – FastGenericNew
 
 

name FastGenericNew
nuget https://www.nuget.org/packages/FastGenericNew.SourceGenerator/
link https://github.com/Nyrest/FastGenericNew
author Boring3 Nyrest

Creating instances fast. As generator show source code. Otherwise could be a dll

 

This is how you can use FastGenericNew .

The code that you start with is


<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
	<PropertyGroup>
		<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
		<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
	</PropertyGroup>
	<ItemGroup>
	  <PackageReference Include="FastGenericNew.SourceGenerator" Version="3.1.0-preview1">
	    <PrivateAssets>all</PrivateAssets>
	    <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
	  </PackageReference>
	</ItemGroup>
</Project>


The code that you will use is


// See https://aka.ms/new-console-template for more information
using FastGenericNew;
using FastGenericNewDemo;

Console.WriteLine("Hello, World!");
//private constructor
var p= FastNew.CreateInstance<Person>() ;
Console.WriteLine(p.FirstName);
//public constructor
p = FastNew.CreateInstance<Person,string>("test");
Console.WriteLine(p.FirstName);




namespace FastGenericNewDemo;

class Person
{
    private Person()
    {
        FirstName = "Andrei";
    }
    public Person(string firstName)
    {
        this.FirstName=firstName;
    }
    public string FirstName { get; set; }
}


 

The code that is generated is

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by FastGenericNew.SourceGenerator
//     Please do not modify this file directly
// <auto-generated/>
//------------------------------------------------------------------------------
#nullable enable
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Reflection.Emit;
using System.ComponentModel;

namespace @FastGenericNew
{
public static partial class FastNew{

        /// <summary>
        /// <para>Create an instance of <typeparamref name="T" /></para>
        /// <para>Returns <c><see langword="new" /> <typeparamref name="T" />()</c> if <typeparamref name="T"/> is a <see cref="ValueType"/>(struct)</para>
        /// <para>This <b>CAN</b> call the Parameterless Constructor of the <see cref="ValueType"/>(struct)</para>
        /// </summary>
        /// <typeparam name="T">The type to create.</typeparam>
        /// <returns>A new instance of <typeparamref name="T" /></returns>
        /// <remarks>
        /// Equivalent to <c><see langword="new" /> <typeparamref name="T" />()</c> for both Reference Types and Value Types
        /// </remarks>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
	    public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T>()
	    {
#if NETFRAMEWORK
            return global::@FastGenericNew.FastNew<T>.CompiledDelegate();
#else
		    return typeof(T).IsValueType
                ? System.Activator.CreateInstance<T>() // This will be optimized by JIT
                : global::@FastGenericNew.FastNew<T>.CompiledDelegate();
#endif
	    }
        /// <summary>
        /// Create an instance of <typeparamref name="T" /> <br/>
        /// Returns <c><see langword="default" />(<typeparamref name="T" />)</c> if <typeparamref name="T"/> is a <see cref="ValueType"/>(struct) <br/>
        /// This <b>WILL NOT</b> call the Parameterless Constructor of the <see cref="ValueType"/>(struct)
        /// </summary>
        /// <typeparam name="T">The type to create.</typeparam>
        /// <returns>A new instance of <typeparamref name="T" /></returns>
        /// <remarks>
        /// For reference types, equivalent to <c><see langword="new" /> <typeparamref name="T" />()</c> <br/>
        /// For value types, equivalent to <c><see langword="default" />(<typeparamref name="T" />)</c>
        /// </remarks>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
	    public static T NewOrDefault<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T>()
	    {
#if NETFRAMEWORK
		    return global::@FastGenericNew.FastNew<T>._isValueTypeT
#else
		    return typeof(T).IsValueType
#endif
                ? default(T)! // This will never be null since T is a ValueType
                : FastNew<T>.CompiledDelegate();
	    }
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0>(TArg0 p0) =>
global::@FastGenericNew.FastNew<T, TArg0>.CompiledDelegate(p0);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1>(TArg0 p0, TArg1 p1) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1>.CompiledDelegate(p0, p1);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2>(TArg0 p0, TArg1 p1, TArg2 p2) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2>.CompiledDelegate(p0, p1, p2);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3>.CompiledDelegate(p0, p1, p2, p3);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4>.CompiledDelegate(p0, p1, p2, p3, p4);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5>.CompiledDelegate(p0, p1, p2, p3, p4, p5);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, TArg9 p9) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, TArg9 p9, TArg10 p10) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, TArg9 p9, TArg10 p10, TArg11 p11) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, TArg9 p9, TArg10 p10, TArg11 p11, TArg12 p12) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, TArg9 p9, TArg10 p10, TArg11 p11, TArg12 p12, TArg13 p13) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, TArg9 p9, TArg10 p10, TArg11 p11, TArg12 p12, TArg13 p13, TArg14 p14) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14);
public static T CreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, TArg9 p9, TArg10 p10, TArg11 p11, TArg12 p12, TArg13 p13, TArg14 p14, TArg15 p15) =>
global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15);
}
}

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by FastGenericNew.SourceGenerator
//     Please do not modify this file directly
// <auto-generated/>
//------------------------------------------------------------------------------
#nullable enable
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Reflection.Emit;
using System.ComponentModel;

namespace @FastGenericNew
{
public static partial class FastNew{

	    [MethodImpl(MethodImplOptions.AggressiveInlining)]
	    public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T>(out T result)
	    {
            if(global::@FastGenericNew.FastNew<T>.IsValid)
            {
#if NETFRAMEWORK
                result = global::@FastGenericNew.FastNew<T>.CompiledDelegate();
#else
		        result = typeof(T).IsValueType
                    ? System.Activator.CreateInstance<T>()
                    : global::@FastGenericNew.FastNew<T>.CompiledDelegate();
#endif
                return true;
            }
	        //Unsafe.SkipInit<T>(out result);
            result = default!;
	        return false;
	    }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
	    public static bool TryNewOrDefault<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T>(out T result)
	    {
            if(global::@FastGenericNew.FastNew<T>.IsValid)
            {
#if NETFRAMEWORK
		        result = global::@FastGenericNew.FastNew<T>._isValueTypeT
#else
    		    result = typeof(T).IsValueType
#endif
                    ? default(T)! // This will never be null since T is a ValueType
                    : FastNew<T>.CompiledDelegate();
                    return true;
            }
	        //Unsafe.SkipInit<T>(out result);
            result = default!;
	        return false;
	    }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0>(TArg0 p0, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0>.CompiledDelegate(p0);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1>(TArg0 p0, TArg1 p1, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1>.CompiledDelegate(p0, p1);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2>(TArg0 p0, TArg1 p1, TArg2 p2, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2>.CompiledDelegate(p0, p1, p2);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3>.CompiledDelegate(p0, p1, p2, p3);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4>.CompiledDelegate(p0, p1, p2, p3, p4);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5>.CompiledDelegate(p0, p1, p2, p3, p4, p5);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, TArg9 p9, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, TArg9 p9, TArg10 p10, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, TArg9 p9, TArg10 p10, TArg11 p11, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, TArg9 p9, TArg10 p10, TArg11 p11, TArg12 p12, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, TArg9 p9, TArg10 p10, TArg11 p11, TArg12 p12, TArg13 p13, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, TArg9 p9, TArg10 p10, TArg11 p11, TArg12 p12, TArg13 p13, TArg14 p14, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14);
return true;
}
result = default!;return false;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(TArg0 p0, TArg1 p1, TArg2 p2, TArg3 p3, TArg4 p4, TArg5 p5, TArg6 p6, TArg7 p7, TArg8 p8, TArg9 p9, TArg10 p10, TArg11 p11, TArg12 p12, TArg13 p13, TArg14 p14, TArg15 p15, out T result)
{
if (global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>.IsValid)
{
result = global::@FastGenericNew.FastNew<T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>.CompiledDelegate(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15);
return true;
}
result = default!;return false;
}
}
}

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by FastGenericNew.SourceGenerator
//     Please do not modify this file directly
// <auto-generated/>
//------------------------------------------------------------------------------
#nullable enable
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Reflection.Emit;
using System.ComponentModel;

namespace @FastGenericNew
{
internal 
#if NETFRAMEWORK
static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T>
    {
#if NETFRAMEWORK
        [EditorBrowsable(EditorBrowsableState.Never)]
        internal static readonly bool _isValueTypeT = typeof(T).IsValueType;
#endif
		/// <summary>
		/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
		/// Could be <see langword="null" /> if the constructor couldn't be found.
		/// </summary>
		public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null);

	    public static readonly Func<T> CompiledDelegate = System.Linq.Expressions.Expression.Lambda<Func<T>>(typeof(T).IsValueType
            ? (global::@FastGenericNew.FastNew<T>.CachedConstructor != null
                ? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(global::@FastGenericNew.FastNew<T>.CachedConstructor)
                : (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(typeof(T)))
            : ((global::@FastGenericNew.FastNew<T>.CachedConstructor != null && !typeof(T).IsAbstract)
                ? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(global::@FastGenericNew.FastNew<T>.CachedConstructor)
                : (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>()))
            , Array.Empty<System.Linq.Expressions.ParameterExpression>()).Compile();
    
        public static readonly bool IsValid = typeof(T).IsValueType || (global::@FastGenericNew.FastNew<T>.CachedConstructor != null && !typeof(T).IsAbstract);
    }
#else
static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T>
    {
		/// <summary>
		/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
		/// Could be <see langword="null" /> if the constructor couldn't be found.
		/// </summary>
		public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null);

#if NETFRAMEWORK
        [EditorBrowsable(EditorBrowsableState.Never)]
        internal static readonly bool _isValueTypeT = typeof(T).IsValueType;
#endif

	    public static readonly Func<T> CompiledDelegate;
    
        public static readonly bool IsValid = typeof(T).IsValueType || (global::@FastGenericNew.FastNew<T>.CachedConstructor != null && !typeof(T).IsAbstract);
    
        static FastNew()
        {
            var dm = new DynamicMethod("", typeof(T), global::@FastGenericNew._FastNewDynMetClosure.InstanceOnlyArray, restrictedSkipVisibility: true);
            var il = dm.GetILGenerator();
            if (IsValid)
            {
                if (global::@FastGenericNew.FastNew<T>.CachedConstructor != null)
                    il.Emit(OpCodes.Newobj, CachedConstructor!);
                else
                {
                    il.DeclareLocal(typeof(T));
                    //il.Emit(OpCodes.Ldloca_S, (short)0)
                    //il.Emit(OpCodes.Initobj, typeof(T));
                    il.Emit(OpCodes.Ldloc_0);
                }
            }
            else
            {
                il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
            }
            il.Emit(OpCodes.Ret);
            CompiledDelegate = (Func<T>)dm.CreateDelegate(typeof(Func<T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
        }
    }
#endif
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
}, null);
public static readonly Func<TArg0, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(10);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, T>)dm.CreateDelegate(typeof(Func<TArg0, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
}, null);
public static readonly Func<TArg0, TArg1, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(11);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
typeof(TArg2),
}, null);
public static readonly Func<TArg0, TArg1, TArg2, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
var p2 = System.Linq.Expressions.Expression.Parameter(typeof(TArg2));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, TArg2, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1, p2)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1, p2 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1), typeof(TArg2) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(12);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldarg_3);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, TArg2, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, TArg2, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
typeof(TArg2),
typeof(TArg3),
}, null);
public static readonly Func<TArg0, TArg1, TArg2, TArg3, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
var p2 = System.Linq.Expressions.Expression.Parameter(typeof(TArg2));
var p3 = System.Linq.Expressions.Expression.Parameter(typeof(TArg3));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, TArg2, TArg3, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1, p2, p3)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1, p2, p3 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1), typeof(TArg2), typeof(TArg3) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(13);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldarg_3);
il.Emit(OpCodes.Ldarg_S, (byte)4);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, TArg2, TArg3, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, TArg2, TArg3, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
typeof(TArg2),
typeof(TArg3),
typeof(TArg4),
}, null);
public static readonly Func<TArg0, TArg1, TArg2, TArg3, TArg4, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
var p2 = System.Linq.Expressions.Expression.Parameter(typeof(TArg2));
var p3 = System.Linq.Expressions.Expression.Parameter(typeof(TArg3));
var p4 = System.Linq.Expressions.Expression.Parameter(typeof(TArg4));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, TArg2, TArg3, TArg4, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1, p2, p3, p4)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1, p2, p3, p4 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(14);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldarg_3);
il.Emit(OpCodes.Ldarg_S, (byte)4);
il.Emit(OpCodes.Ldarg_S, (byte)5);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, TArg2, TArg3, TArg4, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, TArg2, TArg3, TArg4, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
typeof(TArg2),
typeof(TArg3),
typeof(TArg4),
typeof(TArg5),
}, null);
public static readonly Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
var p2 = System.Linq.Expressions.Expression.Parameter(typeof(TArg2));
var p3 = System.Linq.Expressions.Expression.Parameter(typeof(TArg3));
var p4 = System.Linq.Expressions.Expression.Parameter(typeof(TArg4));
var p5 = System.Linq.Expressions.Expression.Parameter(typeof(TArg5));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1, p2, p3, p4, p5)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1, p2, p3, p4, p5 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(15);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldarg_3);
il.Emit(OpCodes.Ldarg_S, (byte)4);
il.Emit(OpCodes.Ldarg_S, (byte)5);
il.Emit(OpCodes.Ldarg_S, (byte)6);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
typeof(TArg2),
typeof(TArg3),
typeof(TArg4),
typeof(TArg5),
typeof(TArg6),
}, null);
public static readonly Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
var p2 = System.Linq.Expressions.Expression.Parameter(typeof(TArg2));
var p3 = System.Linq.Expressions.Expression.Parameter(typeof(TArg3));
var p4 = System.Linq.Expressions.Expression.Parameter(typeof(TArg4));
var p5 = System.Linq.Expressions.Expression.Parameter(typeof(TArg5));
var p6 = System.Linq.Expressions.Expression.Parameter(typeof(TArg6));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1, p2, p3, p4, p5, p6)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1, p2, p3, p4, p5, p6 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(16);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldarg_3);
il.Emit(OpCodes.Ldarg_S, (byte)4);
il.Emit(OpCodes.Ldarg_S, (byte)5);
il.Emit(OpCodes.Ldarg_S, (byte)6);
il.Emit(OpCodes.Ldarg_S, (byte)7);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
typeof(TArg2),
typeof(TArg3),
typeof(TArg4),
typeof(TArg5),
typeof(TArg6),
typeof(TArg7),
}, null);
public static readonly Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
var p2 = System.Linq.Expressions.Expression.Parameter(typeof(TArg2));
var p3 = System.Linq.Expressions.Expression.Parameter(typeof(TArg3));
var p4 = System.Linq.Expressions.Expression.Parameter(typeof(TArg4));
var p5 = System.Linq.Expressions.Expression.Parameter(typeof(TArg5));
var p6 = System.Linq.Expressions.Expression.Parameter(typeof(TArg6));
var p7 = System.Linq.Expressions.Expression.Parameter(typeof(TArg7));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1, p2, p3, p4, p5, p6, p7)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1, p2, p3, p4, p5, p6, p7 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(17);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldarg_3);
il.Emit(OpCodes.Ldarg_S, (byte)4);
il.Emit(OpCodes.Ldarg_S, (byte)5);
il.Emit(OpCodes.Ldarg_S, (byte)6);
il.Emit(OpCodes.Ldarg_S, (byte)7);
il.Emit(OpCodes.Ldarg_S, (byte)8);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
typeof(TArg2),
typeof(TArg3),
typeof(TArg4),
typeof(TArg5),
typeof(TArg6),
typeof(TArg7),
typeof(TArg8),
}, null);
public static readonly Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
var p2 = System.Linq.Expressions.Expression.Parameter(typeof(TArg2));
var p3 = System.Linq.Expressions.Expression.Parameter(typeof(TArg3));
var p4 = System.Linq.Expressions.Expression.Parameter(typeof(TArg4));
var p5 = System.Linq.Expressions.Expression.Parameter(typeof(TArg5));
var p6 = System.Linq.Expressions.Expression.Parameter(typeof(TArg6));
var p7 = System.Linq.Expressions.Expression.Parameter(typeof(TArg7));
var p8 = System.Linq.Expressions.Expression.Parameter(typeof(TArg8));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1, p2, p3, p4, p5, p6, p7, p8)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1, p2, p3, p4, p5, p6, p7, p8 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(18);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldarg_3);
il.Emit(OpCodes.Ldarg_S, (byte)4);
il.Emit(OpCodes.Ldarg_S, (byte)5);
il.Emit(OpCodes.Ldarg_S, (byte)6);
il.Emit(OpCodes.Ldarg_S, (byte)7);
il.Emit(OpCodes.Ldarg_S, (byte)8);
il.Emit(OpCodes.Ldarg_S, (byte)9);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
typeof(TArg2),
typeof(TArg3),
typeof(TArg4),
typeof(TArg5),
typeof(TArg6),
typeof(TArg7),
typeof(TArg8),
typeof(TArg9),
}, null);
public static readonly Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
var p2 = System.Linq.Expressions.Expression.Parameter(typeof(TArg2));
var p3 = System.Linq.Expressions.Expression.Parameter(typeof(TArg3));
var p4 = System.Linq.Expressions.Expression.Parameter(typeof(TArg4));
var p5 = System.Linq.Expressions.Expression.Parameter(typeof(TArg5));
var p6 = System.Linq.Expressions.Expression.Parameter(typeof(TArg6));
var p7 = System.Linq.Expressions.Expression.Parameter(typeof(TArg7));
var p8 = System.Linq.Expressions.Expression.Parameter(typeof(TArg8));
var p9 = System.Linq.Expressions.Expression.Parameter(typeof(TArg9));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(19);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldarg_3);
il.Emit(OpCodes.Ldarg_S, (byte)4);
il.Emit(OpCodes.Ldarg_S, (byte)5);
il.Emit(OpCodes.Ldarg_S, (byte)6);
il.Emit(OpCodes.Ldarg_S, (byte)7);
il.Emit(OpCodes.Ldarg_S, (byte)8);
il.Emit(OpCodes.Ldarg_S, (byte)9);
il.Emit(OpCodes.Ldarg_S, (byte)10);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
typeof(TArg2),
typeof(TArg3),
typeof(TArg4),
typeof(TArg5),
typeof(TArg6),
typeof(TArg7),
typeof(TArg8),
typeof(TArg9),
typeof(TArg10),
}, null);
public static readonly Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
var p2 = System.Linq.Expressions.Expression.Parameter(typeof(TArg2));
var p3 = System.Linq.Expressions.Expression.Parameter(typeof(TArg3));
var p4 = System.Linq.Expressions.Expression.Parameter(typeof(TArg4));
var p5 = System.Linq.Expressions.Expression.Parameter(typeof(TArg5));
var p6 = System.Linq.Expressions.Expression.Parameter(typeof(TArg6));
var p7 = System.Linq.Expressions.Expression.Parameter(typeof(TArg7));
var p8 = System.Linq.Expressions.Expression.Parameter(typeof(TArg8));
var p9 = System.Linq.Expressions.Expression.Parameter(typeof(TArg9));
var p10 = System.Linq.Expressions.Expression.Parameter(typeof(TArg10));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(20);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldarg_3);
il.Emit(OpCodes.Ldarg_S, (byte)4);
il.Emit(OpCodes.Ldarg_S, (byte)5);
il.Emit(OpCodes.Ldarg_S, (byte)6);
il.Emit(OpCodes.Ldarg_S, (byte)7);
il.Emit(OpCodes.Ldarg_S, (byte)8);
il.Emit(OpCodes.Ldarg_S, (byte)9);
il.Emit(OpCodes.Ldarg_S, (byte)10);
il.Emit(OpCodes.Ldarg_S, (byte)11);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
typeof(TArg2),
typeof(TArg3),
typeof(TArg4),
typeof(TArg5),
typeof(TArg6),
typeof(TArg7),
typeof(TArg8),
typeof(TArg9),
typeof(TArg10),
typeof(TArg11),
}, null);
public static readonly Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
var p2 = System.Linq.Expressions.Expression.Parameter(typeof(TArg2));
var p3 = System.Linq.Expressions.Expression.Parameter(typeof(TArg3));
var p4 = System.Linq.Expressions.Expression.Parameter(typeof(TArg4));
var p5 = System.Linq.Expressions.Expression.Parameter(typeof(TArg5));
var p6 = System.Linq.Expressions.Expression.Parameter(typeof(TArg6));
var p7 = System.Linq.Expressions.Expression.Parameter(typeof(TArg7));
var p8 = System.Linq.Expressions.Expression.Parameter(typeof(TArg8));
var p9 = System.Linq.Expressions.Expression.Parameter(typeof(TArg9));
var p10 = System.Linq.Expressions.Expression.Parameter(typeof(TArg10));
var p11 = System.Linq.Expressions.Expression.Parameter(typeof(TArg11));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(21);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldarg_3);
il.Emit(OpCodes.Ldarg_S, (byte)4);
il.Emit(OpCodes.Ldarg_S, (byte)5);
il.Emit(OpCodes.Ldarg_S, (byte)6);
il.Emit(OpCodes.Ldarg_S, (byte)7);
il.Emit(OpCodes.Ldarg_S, (byte)8);
il.Emit(OpCodes.Ldarg_S, (byte)9);
il.Emit(OpCodes.Ldarg_S, (byte)10);
il.Emit(OpCodes.Ldarg_S, (byte)11);
il.Emit(OpCodes.Ldarg_S, (byte)12);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
typeof(TArg2),
typeof(TArg3),
typeof(TArg4),
typeof(TArg5),
typeof(TArg6),
typeof(TArg7),
typeof(TArg8),
typeof(TArg9),
typeof(TArg10),
typeof(TArg11),
typeof(TArg12),
}, null);
public static readonly Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
var p2 = System.Linq.Expressions.Expression.Parameter(typeof(TArg2));
var p3 = System.Linq.Expressions.Expression.Parameter(typeof(TArg3));
var p4 = System.Linq.Expressions.Expression.Parameter(typeof(TArg4));
var p5 = System.Linq.Expressions.Expression.Parameter(typeof(TArg5));
var p6 = System.Linq.Expressions.Expression.Parameter(typeof(TArg6));
var p7 = System.Linq.Expressions.Expression.Parameter(typeof(TArg7));
var p8 = System.Linq.Expressions.Expression.Parameter(typeof(TArg8));
var p9 = System.Linq.Expressions.Expression.Parameter(typeof(TArg9));
var p10 = System.Linq.Expressions.Expression.Parameter(typeof(TArg10));
var p11 = System.Linq.Expressions.Expression.Parameter(typeof(TArg11));
var p12 = System.Linq.Expressions.Expression.Parameter(typeof(TArg12));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(22);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldarg_3);
il.Emit(OpCodes.Ldarg_S, (byte)4);
il.Emit(OpCodes.Ldarg_S, (byte)5);
il.Emit(OpCodes.Ldarg_S, (byte)6);
il.Emit(OpCodes.Ldarg_S, (byte)7);
il.Emit(OpCodes.Ldarg_S, (byte)8);
il.Emit(OpCodes.Ldarg_S, (byte)9);
il.Emit(OpCodes.Ldarg_S, (byte)10);
il.Emit(OpCodes.Ldarg_S, (byte)11);
il.Emit(OpCodes.Ldarg_S, (byte)12);
il.Emit(OpCodes.Ldarg_S, (byte)13);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
typeof(TArg2),
typeof(TArg3),
typeof(TArg4),
typeof(TArg5),
typeof(TArg6),
typeof(TArg7),
typeof(TArg8),
typeof(TArg9),
typeof(TArg10),
typeof(TArg11),
typeof(TArg12),
typeof(TArg13),
}, null);
public static readonly Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
var p2 = System.Linq.Expressions.Expression.Parameter(typeof(TArg2));
var p3 = System.Linq.Expressions.Expression.Parameter(typeof(TArg3));
var p4 = System.Linq.Expressions.Expression.Parameter(typeof(TArg4));
var p5 = System.Linq.Expressions.Expression.Parameter(typeof(TArg5));
var p6 = System.Linq.Expressions.Expression.Parameter(typeof(TArg6));
var p7 = System.Linq.Expressions.Expression.Parameter(typeof(TArg7));
var p8 = System.Linq.Expressions.Expression.Parameter(typeof(TArg8));
var p9 = System.Linq.Expressions.Expression.Parameter(typeof(TArg9));
var p10 = System.Linq.Expressions.Expression.Parameter(typeof(TArg10));
var p11 = System.Linq.Expressions.Expression.Parameter(typeof(TArg11));
var p12 = System.Linq.Expressions.Expression.Parameter(typeof(TArg12));
var p13 = System.Linq.Expressions.Expression.Parameter(typeof(TArg13));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(23);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldarg_3);
il.Emit(OpCodes.Ldarg_S, (byte)4);
il.Emit(OpCodes.Ldarg_S, (byte)5);
il.Emit(OpCodes.Ldarg_S, (byte)6);
il.Emit(OpCodes.Ldarg_S, (byte)7);
il.Emit(OpCodes.Ldarg_S, (byte)8);
il.Emit(OpCodes.Ldarg_S, (byte)9);
il.Emit(OpCodes.Ldarg_S, (byte)10);
il.Emit(OpCodes.Ldarg_S, (byte)11);
il.Emit(OpCodes.Ldarg_S, (byte)12);
il.Emit(OpCodes.Ldarg_S, (byte)13);
il.Emit(OpCodes.Ldarg_S, (byte)14);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
typeof(TArg2),
typeof(TArg3),
typeof(TArg4),
typeof(TArg5),
typeof(TArg6),
typeof(TArg7),
typeof(TArg8),
typeof(TArg9),
typeof(TArg10),
typeof(TArg11),
typeof(TArg12),
typeof(TArg13),
typeof(TArg14),
}, null);
public static readonly Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
var p2 = System.Linq.Expressions.Expression.Parameter(typeof(TArg2));
var p3 = System.Linq.Expressions.Expression.Parameter(typeof(TArg3));
var p4 = System.Linq.Expressions.Expression.Parameter(typeof(TArg4));
var p5 = System.Linq.Expressions.Expression.Parameter(typeof(TArg5));
var p6 = System.Linq.Expressions.Expression.Parameter(typeof(TArg6));
var p7 = System.Linq.Expressions.Expression.Parameter(typeof(TArg7));
var p8 = System.Linq.Expressions.Expression.Parameter(typeof(TArg8));
var p9 = System.Linq.Expressions.Expression.Parameter(typeof(TArg9));
var p10 = System.Linq.Expressions.Expression.Parameter(typeof(TArg10));
var p11 = System.Linq.Expressions.Expression.Parameter(typeof(TArg11));
var p12 = System.Linq.Expressions.Expression.Parameter(typeof(TArg12));
var p13 = System.Linq.Expressions.Expression.Parameter(typeof(TArg13));
var p14 = System.Linq.Expressions.Expression.Parameter(typeof(TArg14));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(24);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldarg_3);
il.Emit(OpCodes.Ldarg_S, (byte)4);
il.Emit(OpCodes.Ldarg_S, (byte)5);
il.Emit(OpCodes.Ldarg_S, (byte)6);
il.Emit(OpCodes.Ldarg_S, (byte)7);
il.Emit(OpCodes.Ldarg_S, (byte)8);
il.Emit(OpCodes.Ldarg_S, (byte)9);
il.Emit(OpCodes.Ldarg_S, (byte)10);
il.Emit(OpCodes.Ldarg_S, (byte)11);
il.Emit(OpCodes.Ldarg_S, (byte)12);
il.Emit(OpCodes.Ldarg_S, (byte)13);
il.Emit(OpCodes.Ldarg_S, (byte)14);
il.Emit(OpCodes.Ldarg_S, (byte)15);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
internal static partial class FastNew<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>
{
/// <summary>
/// The constructor of <typeparamref name="T" /> with given arguments. <br/>
/// Could be <see langword="null" /> if the constructor couldn't be found.
/// </summary>
public static readonly ConstructorInfo? CachedConstructor = typeof(T).GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[]
{
typeof(TArg0),
typeof(TArg1),
typeof(TArg2),
typeof(TArg3),
typeof(TArg4),
typeof(TArg5),
typeof(TArg6),
typeof(TArg7),
typeof(TArg8),
typeof(TArg9),
typeof(TArg10),
typeof(TArg11),
typeof(TArg12),
typeof(TArg13),
typeof(TArg14),
typeof(TArg15),
}, null);
public static readonly Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, T> CompiledDelegate;
public static readonly bool IsValid;
static FastNew()
{
IsValid = CachedConstructor != null && !typeof(T).IsAbstract;
#if NETFRAMEWORK
var p0 = System.Linq.Expressions.Expression.Parameter(typeof(TArg0));
var p1 = System.Linq.Expressions.Expression.Parameter(typeof(TArg1));
var p2 = System.Linq.Expressions.Expression.Parameter(typeof(TArg2));
var p3 = System.Linq.Expressions.Expression.Parameter(typeof(TArg3));
var p4 = System.Linq.Expressions.Expression.Parameter(typeof(TArg4));
var p5 = System.Linq.Expressions.Expression.Parameter(typeof(TArg5));
var p6 = System.Linq.Expressions.Expression.Parameter(typeof(TArg6));
var p7 = System.Linq.Expressions.Expression.Parameter(typeof(TArg7));
var p8 = System.Linq.Expressions.Expression.Parameter(typeof(TArg8));
var p9 = System.Linq.Expressions.Expression.Parameter(typeof(TArg9));
var p10 = System.Linq.Expressions.Expression.Parameter(typeof(TArg10));
var p11 = System.Linq.Expressions.Expression.Parameter(typeof(TArg11));
var p12 = System.Linq.Expressions.Expression.Parameter(typeof(TArg12));
var p13 = System.Linq.Expressions.Expression.Parameter(typeof(TArg13));
var p14 = System.Linq.Expressions.Expression.Parameter(typeof(TArg14));
var p15 = System.Linq.Expressions.Expression.Parameter(typeof(TArg15));
CompiledDelegate = (System.Linq.Expressions.Expression.Lambda<Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, T>>(IsValid
? (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.New(CachedConstructor!, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15)
: (System.Linq.Expressions.Expression)System.Linq.Expressions.Expression.Call(global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>())
, new System.Linq.Expressions.ParameterExpression[] { p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15 })).Compile();
#else
var dm = new DynamicMethod("", typeof(T), new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure), typeof(TArg0), typeof(TArg1), typeof(TArg2), typeof(TArg3), typeof(TArg4), typeof(TArg5), typeof(TArg6), typeof(TArg7), typeof(TArg8), typeof(TArg9), typeof(TArg10), typeof(TArg11), typeof(TArg12), typeof(TArg13), typeof(TArg14), typeof(TArg15) }, restrictedSkipVisibility: true);
var il = dm.GetILGenerator(25);
if (IsValid)
{
il.Emit(OpCodes.Ldarg_1);
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldarg_3);
il.Emit(OpCodes.Ldarg_S, (byte)4);
il.Emit(OpCodes.Ldarg_S, (byte)5);
il.Emit(OpCodes.Ldarg_S, (byte)6);
il.Emit(OpCodes.Ldarg_S, (byte)7);
il.Emit(OpCodes.Ldarg_S, (byte)8);
il.Emit(OpCodes.Ldarg_S, (byte)9);
il.Emit(OpCodes.Ldarg_S, (byte)10);
il.Emit(OpCodes.Ldarg_S, (byte)11);
il.Emit(OpCodes.Ldarg_S, (byte)12);
il.Emit(OpCodes.Ldarg_S, (byte)13);
il.Emit(OpCodes.Ldarg_S, (byte)14);
il.Emit(OpCodes.Ldarg_S, (byte)15);
il.Emit(OpCodes.Ldarg_S, (byte)16);
il.Emit(OpCodes.Newobj, CachedConstructor!);
}
else
{
il.Emit(OpCodes.Call, global::@FastGenericNew.ThrowHelper.GetSmartThrow<T>());
}
il.Emit(OpCodes.Ret);
CompiledDelegate = (Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, T>)dm.CreateDelegate(typeof(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, T>), global::@FastGenericNew._FastNewDynMetClosure.Instance);
#endif
}
}
}

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by FastGenericNew.SourceGenerator
//     Please do not modify this file directly
// <auto-generated/>
//------------------------------------------------------------------------------
#nullable enable
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Reflection.Emit;
using System.ComponentModel;

namespace @FastGenericNew
{

    [EditorBrowsable(EditorBrowsableState.Never)]
    internal static partial class ThrowHelper
    {
        [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]

#if NET5_0_OR_GREATER
        [DynamicDependency("SmartThrowImpl``1()", typeof(global::@FastGenericNew.ThrowHelper))]
#endif

        public static System.Reflection.MethodInfo GetSmartThrow<T>() => typeof(global::@FastGenericNew.ThrowHelper).GetMethod("SmartThrowImpl", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static)!.MakeGenericMethod(typeof(T));

        public static T SmartThrowImpl<T>()
        {
            var qualifiedName = typeof(T).AssemblyQualifiedName;

            if (typeof(T).IsInterface)
                throw new System.MissingMethodException($"Cannot create an instance of an interface: '{ qualifiedName }'");

            if (typeof(T).IsAbstract)
                throw new System.MissingMethodException($"Cannot create an abstract class: '{ qualifiedName }'");

            throw new System.MissingMethodException($"No match constructor found in type: '{ qualifiedName }'");
        }
    }
}

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by FastGenericNew.SourceGenerator
//     Please do not modify this file directly
// <auto-generated/>
//------------------------------------------------------------------------------
#nullable enable
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Reflection.Emit;
using System.ComponentModel;

namespace @FastGenericNew
{
public static partial class FastNew{
public static Func<T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T>(Type type) =>
(Func<T>)typeof(FastNew<>).MakeGenericType(type).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0>(Type type, Type p0) =>
(Func<TArg0, T>)typeof(FastNew<,>).MakeGenericType(type, p0).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1>(Type type, Type p0, Type p1) =>
(Func<TArg0, TArg1, T>)typeof(FastNew<,,>).MakeGenericType(type, p0, p1).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, TArg2, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2>(Type type, Type p0, Type p1, Type p2) =>
(Func<TArg0, TArg1, TArg2, T>)typeof(FastNew<,,,>).MakeGenericType(type, p0, p1, p2).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, TArg2, TArg3, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3>(Type type, Type p0, Type p1, Type p2, Type p3) =>
(Func<TArg0, TArg1, TArg2, TArg3, T>)typeof(FastNew<,,,,>).MakeGenericType(type, p0, p1, p2, p3).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, TArg2, TArg3, TArg4, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4>(Type type, Type p0, Type p1, Type p2, Type p3, Type p4) =>
(Func<TArg0, TArg1, TArg2, TArg3, TArg4, T>)typeof(FastNew<,,,,,>).MakeGenericType(type, p0, p1, p2, p3, p4).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5>(Type type, Type p0, Type p1, Type p2, Type p3, Type p4, Type p5) =>
(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, T>)typeof(FastNew<,,,,,,>).MakeGenericType(type, p0, p1, p2, p3, p4, p5).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6>(Type type, Type p0, Type p1, Type p2, Type p3, Type p4, Type p5, Type p6) =>
(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, T>)typeof(FastNew<,,,,,,,>).MakeGenericType(type, p0, p1, p2, p3, p4, p5, p6).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7>(Type type, Type p0, Type p1, Type p2, Type p3, Type p4, Type p5, Type p6, Type p7) =>
(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, T>)typeof(FastNew<,,,,,,,,>).MakeGenericType(type, p0, p1, p2, p3, p4, p5, p6, p7).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8>(Type type, Type p0, Type p1, Type p2, Type p3, Type p4, Type p5, Type p6, Type p7, Type p8) =>
(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, T>)typeof(FastNew<,,,,,,,,,>).MakeGenericType(type, p0, p1, p2, p3, p4, p5, p6, p7, p8).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9>(Type type, Type p0, Type p1, Type p2, Type p3, Type p4, Type p5, Type p6, Type p7, Type p8, Type p9) =>
(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, T>)typeof(FastNew<,,,,,,,,,,>).MakeGenericType(type, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10>(Type type, Type p0, Type p1, Type p2, Type p3, Type p4, Type p5, Type p6, Type p7, Type p8, Type p9, Type p10) =>
(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, T>)typeof(FastNew<,,,,,,,,,,,>).MakeGenericType(type, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11>(Type type, Type p0, Type p1, Type p2, Type p3, Type p4, Type p5, Type p6, Type p7, Type p8, Type p9, Type p10, Type p11) =>
(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, T>)typeof(FastNew<,,,,,,,,,,,,>).MakeGenericType(type, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12>(Type type, Type p0, Type p1, Type p2, Type p3, Type p4, Type p5, Type p6, Type p7, Type p8, Type p9, Type p10, Type p11, Type p12) =>
(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, T>)typeof(FastNew<,,,,,,,,,,,,,>).MakeGenericType(type, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13>(Type type, Type p0, Type p1, Type p2, Type p3, Type p4, Type p5, Type p6, Type p7, Type p8, Type p9, Type p10, Type p11, Type p12, Type p13) =>
(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, T>)typeof(FastNew<,,,,,,,,,,,,,,>).MakeGenericType(type, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14>(Type type, Type p0, Type p1, Type p2, Type p3, Type p4, Type p5, Type p6, Type p7, Type p8, Type p9, Type p10, Type p11, Type p12, Type p13, Type p14) =>
(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, T>)typeof(FastNew<,,,,,,,,,,,,,,,>).MakeGenericType(type, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14).GetField("CompiledDelegate")!.GetValue(null)!;public static Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, T> GetCreateInstance<
#if NET5_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
T, TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15>(Type type, Type p0, Type p1, Type p2, Type p3, Type p4, Type p5, Type p6, Type p7, Type p8, Type p9, Type p10, Type p11, Type p12, Type p13, Type p14, Type p15) =>
(Func<TArg0, TArg1, TArg2, TArg3, TArg4, TArg5, TArg6, TArg7, TArg8, TArg9, TArg10, TArg11, TArg12, TArg13, TArg14, TArg15, T>)typeof(FastNew<,,,,,,,,,,,,,,,,>).MakeGenericType(type, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15).GetField("CompiledDelegate")!.GetValue(null)!;}
}

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by FastGenericNew.SourceGenerator
//     Please do not modify this file directly
// <auto-generated/>
//------------------------------------------------------------------------------
#nullable enable
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Reflection.Emit;
using System.ComponentModel;

namespace @FastGenericNew
{

    [EditorBrowsable(EditorBrowsableState.Never)]
    internal sealed partial class _FastNewDynMetClosure
    {
        public static readonly Type[] InstanceOnlyArray = new Type[] { typeof(global::@FastGenericNew._FastNewDynMetClosure) };

        public static readonly global::@FastGenericNew._FastNewDynMetClosure Instance = new global::@FastGenericNew._FastNewDynMetClosure();
    }
}

Code and pdf at

https://ignatandrei.github.io/RSCG_Examples/v2/docs/FastGenericNew