DotNext by .NET Foundation and Contributors

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

.NET API 564,632 bytes

 Supplier<T, TResult>

public struct Supplier<T, TResult> : ISupplier<T, TResult>, IFunctional<Func<T, TResult>>
Represents typed function pointer implementing ISupplier<T, U>.
using DotNext.Runtime.CompilerServices; using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace DotNext { [StructLayout(LayoutKind.Auto)] [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] [CLSCompliant(false)] public readonly struct Supplier<[System.Runtime.CompilerServices.Nullable(2)] T, [System.Runtime.CompilerServices.Nullable(2)] TResult> : ISupplier<T, TResult>, IFunctional<Func<T, TResult>> { private readonly IntPtr ptr; public unsafe bool IsEmpty => ptr == (IntPtr)(void*)null; public unsafe Supplier([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1 })] IntPtr ptr) { if (ptr == (IntPtr)(void*)null) throw new ArgumentNullException("ptr"); this.ptr = ptr; } TResult ISupplier<T, TResult>.Invoke(T arg) { IntPtr intPtr = ptr; return (TResult); } public Func<T, TResult> ToDelegate() { return DelegateHelpers.CreateDelegate<T, TResult>(ptr); } public unsafe override string ToString() { return new IntPtr((void*)(long)ptr).ToString("X"); } public static implicit operator Supplier<T, TResult>([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1 })] IntPtr ptr) { return new Supplier<T, TResult>(ptr); } public static explicit operator Func<T, TResult>([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1 })] Supplier<T, TResult> supplier) { return supplier.ToDelegate(); } } }