DotNext by .NET Foundation and Contributors

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

.NET API 492,440 bytes

 ComparerWrapper<T>

struct ComparerWrapper<T> : IComparer<T>, ISupplier<T, T, int>, IFunctional<Func<T, T, int>>
using DotNext.Runtime.CompilerServices; using System; using System.Collections.Generic; using System.Runtime.InteropServices; namespace DotNext { [StructLayout(LayoutKind.Auto)] internal readonly struct ComparerWrapper<T> : IComparer<T>, ISupplier<T, T, int>, IFunctional<Func<T, T, int>> { private readonly IntPtr ptr; public unsafe ComparerWrapper(IntPtr ptr) { if (ptr == (IntPtr)(void*)null) throw new ArgumentNullException("ptr"); this.ptr = ptr; } int ISupplier<T, T, int>.Invoke(T x, T y) { IntPtr intPtr = ptr; return (int); } int IComparer<T>.Compare(T x, T y) { IntPtr intPtr = ptr; return (int); } public static implicit operator ComparerWrapper<T>(IntPtr ptr) { return new ComparerWrapper<T>(ptr); } } }