Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/extensionmethods for interface types #193

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

DrPepperBianco
Copy link

This adds methods that are defined in ResultBase, ResultBase<TResult> and Result<TValue> as extensions methods for either IResultBase or IResult<TValue>.

See also: #192

Theses changes allow to do fluent syntax when working
with the interface types instead of the explicit types.

The ceveat is, that because these methods always create
a new Result object, we might lose the covariance here.
ResultExtensions only contains extensions for
Task<…> and Value<…> objects.

All Extensions for IResult<TValue> are now in
IResultTExtensions.

IResultTExtensions is directly in Namespace
FluentResults.

New method "MapReasons()". Makes it easier
to implement MapErros and MapSuccesses.

The overloads of Bind implemented by one method
that is called from the other overloads. There
are two variants. Bind() that returns Result without
value and Bind() that returns Result with value.

Return value is always directly Result or
Result<TValue> except for "MapErrors", because
MapErrors can return the IResult<TValue> argument
directly. All other methods always create a new
object as return value.
seems a better name, also avoids letting a class
start with an I.
Adds methods, that are else defined in ResultBase, so that
they are also available for IResultBase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant