CSharpFunctionalExtensions icon indicating copy to clipboard operation
CSharpFunctionalExtensions copied to clipboard

Missing Match for UnitResult

Open thomaseyde opened this issue 2 years ago • 1 comments

I miss the following Match method for UnitResult:

static class MatchUnitResult
{
    public static R Match<E, R>(this UnitResult<E> result, Func<R> success, Func<E, R> failure) =>
        result.IsSuccess
            ? success()
            : failure(result.Error);
}

thomaseyde avatar Jan 09 '23 21:01 thomaseyde

Thanks for reporting this. Feel free to submit a PR as well.

vkhorikov avatar Jan 20 '23 16:01 vkhorikov

This method is already implemented, so I believe this issue could be closed.

https://github.com/vkhorikov/CSharpFunctionalExtensions/blob/7eb1ae86570ebf6057eb446fdf1cd3f6cc1d0be8/CSharpFunctionalExtensions/Result/Methods/Extensions/Match.cs#L43-L48

bothzoli avatar Jul 24 '24 00:07 bothzoli