FearTheCowboy.Extensions.Core by Garrett Serack (@FearTheCowboy)

<PackageReference Include="FearTheCowboy.Extensions.Core" Version="2.0.0-beta-10145" />

 CompareExtensions

public static class CompareExtensions
using System; namespace FearTheCowboy.Extensions.Core { public static class CompareExtensions { public static bool WithCompareResult(this int result, Func<bool> onLess, Func<bool> onMore, Func<bool> onEqual) { if (result >= 0) { if (result <= 0) return onEqual(); return onMore(); } return onLess(); } public static bool WithCompareResult(this int result, bool lessResult, bool moreResult, bool equalResult) { if (result >= 0) { if (result <= 0) return equalResult; return moreResult; } return lessResult; } public static int WithCompareResult(this int result, int lessResult, int moreResult, int equalResult) { if (result >= 0) { if (result <= 0) return equalResult; return moreResult; } return lessResult; } } }