DotNext by .NET Foundation and Contributors

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

.NET API 581,528 bytes

 ValueSupplier<T>

public struct ValueSupplier<T> : ISupplier<T>, IFunctional<Func<T>>
Represents constant value supplier.
using DotNext.Runtime.CompilerServices; using System; using System.Runtime.CompilerServices; namespace DotNext { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public readonly struct ValueSupplier<[System.Runtime.CompilerServices.Nullable(2)] T> : ISupplier<T>, IFunctional<Func<T>> { private readonly T value; public ValueSupplier(T value) { this.value = value; } T ISupplier<T>.Invoke() { return value; } Func<T> IFunctional<Func<T>>.ToDelegate() { return Func.Constant<T>(value); } public static implicit operator ValueSupplier<T>(T value) { return new ValueSupplier<T>(value); } [System.Runtime.CompilerServices.NullableContext(2)] public override string ToString() { T val = value; return val?.ToString(); } } }