DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="4.1.1" />

 ThreadPoolWorkItemFactory

public static class ThreadPoolWorkItemFactory
Represents factory of thread pool work items.
using System; using System.Runtime.CompilerServices; using System.Threading; namespace DotNext.Threading { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] [CLSCompliant(false)] public static class ThreadPoolWorkItemFactory { [System.Runtime.CompilerServices.NullableContext(0)] [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] private sealed class ThreadPoolWorkItem<[System.Runtime.CompilerServices.Nullable(2)] T> : Tuple<T>, IThreadPoolWorkItem { [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] private readonly IntPtr invoker; [System.Runtime.CompilerServices.NullableContext(1)] internal ThreadPoolWorkItem([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] IntPtr invoker, T arg) : base(arg) { this.invoker = invoker; } void IThreadPoolWorkItem.Execute() { IntPtr intPtr = invoker; ; } } [System.Runtime.CompilerServices.NullableContext(2)] [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1 })] private sealed class ThreadPoolWorkItem<T1, T2> : Tuple<T1, T2>, IThreadPoolWorkItem { [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1 })] private readonly IntPtr invoker; [System.Runtime.CompilerServices.NullableContext(1)] internal ThreadPoolWorkItem([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1 })] IntPtr invoker, T1 arg1, T2 arg2) : base(arg1, arg2) { this.invoker = invoker; } void IThreadPoolWorkItem.Execute() { IntPtr intPtr = invoker; ; } } [System.Runtime.CompilerServices.NullableContext(2)] [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1, 1 })] private sealed class ThreadPoolWorkItem<T1, T2, T3> : Tuple<T1, T2, T3>, IThreadPoolWorkItem { [System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1, 1 })] private readonly IntPtr invoker; [System.Runtime.CompilerServices.NullableContext(1)] internal ThreadPoolWorkItem([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1, 1 })] IntPtr invoker, T1 arg1, T2 arg2, T3 arg3) : base(arg1, arg2, arg3) { this.invoker = invoker; } void IThreadPoolWorkItem.Execute() { IntPtr intPtr = invoker; ; } } public unsafe static IThreadPoolWorkItem Create<[System.Runtime.CompilerServices.Nullable(2)] T>([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] IntPtr workItem, T arg) { if (workItem == (IntPtr)(void*)null) throw new ArgumentNullException("workItem"); return new ThreadPoolWorkItem<T>(workItem, arg); } public unsafe static IThreadPoolWorkItem Create<[System.Runtime.CompilerServices.Nullable(2)] T1, [System.Runtime.CompilerServices.Nullable(2)] T2>([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1 })] IntPtr workItem, T1 arg1, T2 arg2) { if (workItem == (IntPtr)(void*)null) throw new ArgumentNullException("workItem"); return new ThreadPoolWorkItem<T1, T2>(workItem, arg1, arg2); } public unsafe static IThreadPoolWorkItem Create<[System.Runtime.CompilerServices.Nullable(2)] T1, [System.Runtime.CompilerServices.Nullable(2)] T2, [System.Runtime.CompilerServices.Nullable(2)] T3>([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1, 1 })] IntPtr workItem, T1 arg1, T2 arg2, T3 arg3) { if (workItem == (IntPtr)(void*)null) throw new ArgumentNullException("workItem"); return new ThreadPoolWorkItem<T1, T2, T3>(workItem, arg1, arg2, arg3); } } }