DotNext by .NET Foundation and Contributors

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

.NET API 560,536 bytes

 DelegatingPredicate<T>

struct DelegatingPredicate<T> : ISupplier<T, bool>, IFunctional<Func<T, bool>>, IFunctional<Predicate<T>>
using DotNext.Runtime.CompilerServices; using System; using System.Runtime.InteropServices; namespace DotNext { [StructLayout(LayoutKind.Auto)] internal readonly struct DelegatingPredicate<T> : ISupplier<T, bool>, IFunctional<Func<T, bool>>, IFunctional<Predicate<T>> { private readonly Predicate<T> predicate; internal DelegatingPredicate(Predicate<T> predicate) { if (predicate == null) throw new ArgumentNullException("predicate"); this.predicate = predicate; } bool ISupplier<T, bool>.Invoke(T arg) { return predicate(arg); } Func<T, bool> IFunctional<Func<T, bool>>.ToDelegate() { return DelegateHelpers.ChangeType<Func<T, bool>>((Delegate)predicate); } Predicate<T> IFunctional<Predicate<T>>.ToDelegate() { return predicate; } public static implicit operator DelegatingPredicate<T>(Predicate<T> predicate) { return new DelegatingPredicate<T>(predicate); } } }