Class ResultExtensions
Inheritance
System.Object
ResultExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: p1eXu5.Result.dll
Syntax
public static class ResultExtensions
Methods
|
Improve this Doc
View Source
Bimap<TOkA, TOkB, TErrorA, TErrorB>(Result<TOkA, TErrorA>, Func<TOkA, TOkB>, Func<TErrorA, TErrorB>)
Declaration
public static Result<TOkB, TErrorB> Bimap<TOkA, TOkB, TErrorA, TErrorB>(this Result<TOkA, TErrorA> result, Func<TOkA, TOkB> fOk, Func<TErrorA, TErrorB> fErr)
Parameters
Type |
Name |
Description |
Result<TOkA, TErrorA> |
result |
|
Func<TOkA, TOkB> |
fOk |
|
Func<TErrorA, TErrorB> |
fErr |
|
Returns
Type |
Description |
Result<TOkB, TErrorB> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TErrorA |
|
TErrorB |
|
|
Improve this Doc
View Source
Bind<TOkA, TOkB, TError>(Result<TOkA, TError>, Func<TOkA, Result<TOkB, TError>>)
Declaration
public static Result<TOkB, TError> Bind<TOkA, TOkB, TError>(this Result<TOkA, TError> result, Func<TOkA, Result<TOkB, TError>> f)
Parameters
Type |
Name |
Description |
Result<TOkA, TError> |
result |
|
Func<TOkA, Result<TOkB, TError>> |
f |
|
Returns
Type |
Description |
Result<TOkB, TError> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TError |
|
|
Improve this Doc
View Source
BindFlat<TOkA, TOkB, TError>(Result<TOkA, TError>, Func<Result<TOkB, TError>>)
Declaration
public static Result<(TOkA, TOkB), TError> BindFlat<TOkA, TOkB, TError>(this Result<TOkA, TError> result, Func<Result<TOkB, TError>> f)
Parameters
Type |
Name |
Description |
Result<TOkA, TError> |
result |
|
Func<Result<TOkB, TError>> |
f |
|
Returns
Type |
Description |
Result<System.ValueTuple<TOkA, TOkB>, TError> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TError |
|
|
Improve this Doc
View Source
BindFlat<TOkA, TOkB, TOkC, TError>(Result<(TOkA, TOkB), TError>, Func<Result<TOkC, TError>>)
Declaration
public static Result<(TOkA, TOkB, TOkC), TError> BindFlat<TOkA, TOkB, TOkC, TError>(this Result<(TOkA, TOkB), TError> result, Func<Result<TOkC, TError>> f)
Parameters
Type |
Name |
Description |
Result<System.ValueTuple<TOkA, TOkB>, TError> |
result |
|
Func<Result<TOkC, TError>> |
f |
|
Returns
Type |
Description |
Result<System.ValueTuple<TOkA, TOkB, TOkC>, TError> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TOkC |
|
TError |
|
|
Improve this Doc
View Source
BindFlat<TOkA, TOkB, TOkC, TOkD, TError>(Result<(TOkA, TOkB, TOkC), TError>, Func<Result<TOkD, TError>>)
Declaration
public static Result<(TOkA, TOkB, TOkC, TOkD), TError> BindFlat<TOkA, TOkB, TOkC, TOkD, TError>(this Result<(TOkA, TOkB, TOkC), TError> result, Func<Result<TOkD, TError>> f)
Parameters
Type |
Name |
Description |
Result<System.ValueTuple<TOkA, TOkB, TOkC>, TError> |
result |
|
Func<Result<TOkD, TError>> |
f |
|
Returns
Type |
Description |
Result<System.ValueTuple<TOkA, TOkB, TOkC, TOkD>, TError> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TOkC |
|
TOkD |
|
TError |
|
|
Improve this Doc
View Source
FailedContext<TOk, TError>(Result<TOk, TError>)
Declaration
public static TError FailedContext<TOk, TError>(this Result<TOk, TError> result)
Parameters
Type |
Name |
Description |
Result<TOk, TError> |
result |
|
Returns
Type Parameters
Name |
Description |
TOk |
|
TError |
|
|
Improve this Doc
View Source
Filter<TOkA, TError>(Result<TOkA, TError>, Predicate<TOkA>, TError)
Declaration
public static Result<TOkA, TError> Filter<TOkA, TError>(this Result<TOkA, TError> result, Predicate<TOkA> filter, TError defaultError)
Parameters
Type |
Name |
Description |
Result<TOkA, TError> |
result |
|
Predicate<TOkA> |
filter |
|
TError |
defaultError |
|
Returns
Type |
Description |
Result<TOkA, TError> |
|
Type Parameters
Name |
Description |
TOkA |
|
TError |
|
|
Improve this Doc
View Source
FilterError<TOkA, TError>(Result<TOkA, TError>, Predicate<TError>, TOkA)
Declaration
public static Result<TOkA, TError> FilterError<TOkA, TError>(this Result<TOkA, TError> result, Predicate<TError> filter, TOkA defaultOk)
Parameters
Type |
Name |
Description |
Result<TOkA, TError> |
result |
|
Predicate<TError> |
filter |
|
TOkA |
defaultOk |
|
Returns
Type |
Description |
Result<TOkA, TError> |
|
Type Parameters
Name |
Description |
TOkA |
|
TError |
|
|
Improve this Doc
View Source
FlatMap<TOkA, TOkB, TOkResult, TError>(Result<(TOkA, TOkB), TError>, Func<TOkA, TOkB, Result<TOkResult, TError>>)
Declaration
public static Result<TOkResult, TError> FlatMap<TOkA, TOkB, TOkResult, TError>(this Result<(TOkA, TOkB), TError> result, Func<TOkA, TOkB, Result<TOkResult, TError>> f)
Parameters
Type |
Name |
Description |
Result<System.ValueTuple<TOkA, TOkB>, TError> |
result |
|
Func<TOkA, TOkB, Result<TOkResult, TError>> |
f |
|
Returns
Type |
Description |
Result<TOkResult, TError> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TOkResult |
|
TError |
|
|
Improve this Doc
View Source
FlatMap<TOkA, TOkB, TOkC, TOkResult, TError>(Result<(TOkA, TOkB, TOkC), TError>, Func<TOkA, TOkB, TOkC, Result<TOkResult, TError>>)
Declaration
public static Result<TOkResult, TError> FlatMap<TOkA, TOkB, TOkC, TOkResult, TError>(this Result<(TOkA, TOkB, TOkC), TError> result, Func<TOkA, TOkB, TOkC, Result<TOkResult, TError>> f)
Parameters
Type |
Name |
Description |
Result<System.ValueTuple<TOkA, TOkB, TOkC>, TError> |
result |
|
Func<TOkA, TOkB, TOkC, Result<TOkResult, TError>> |
f |
|
Returns
Type |
Description |
Result<TOkResult, TError> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TOkC |
|
TOkResult |
|
TError |
|
|
Improve this Doc
View Source
FlatMap<TOkA, TOkB, TOkC, TOkD, TOkResult, TError>(Result<(TOkA, TOkB, TOkC, TOkD), TError>, Func<TOkA, TOkB, TOkC, TOkD, Result<TOkResult, TError>>)
Declaration
public static Result<TOkResult, TError> FlatMap<TOkA, TOkB, TOkC, TOkD, TOkResult, TError>(this Result<(TOkA, TOkB, TOkC, TOkD), TError> result, Func<TOkA, TOkB, TOkC, TOkD, Result<TOkResult, TError>> f)
Parameters
Type |
Name |
Description |
Result<System.ValueTuple<TOkA, TOkB, TOkC, TOkD>, TError> |
result |
|
Func<TOkA, TOkB, TOkC, TOkD, Result<TOkResult, TError>> |
f |
|
Returns
Type |
Description |
Result<TOkResult, TError> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TOkC |
|
TOkD |
|
TOkResult |
|
TError |
|
|
Improve this Doc
View Source
IsError<TOk, TError>(Result<TOk, TError>)
Declaration
public static bool IsError<TOk, TError>(this Result<TOk, TError> result)
Parameters
Type |
Name |
Description |
Result<TOk, TError> |
result |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
Name |
Description |
TOk |
|
TError |
|
|
Improve this Doc
View Source
IsOk<TOk, TError>(Result<TOk, TError>)
Declaration
public static bool IsOk<TOk, TError>(this Result<TOk, TError> result)
Parameters
Type |
Name |
Description |
Result<TOk, TError> |
result |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
Name |
Description |
TOk |
|
TError |
|
|
Improve this Doc
View Source
Iter<TOk, TError>(Result<TOk, TError>, Action<TOk>)
Declaration
public static Result<TOk, TError> Iter<TOk, TError>(this Result<TOk, TError> result, Action<TOk> action)
Parameters
Type |
Name |
Description |
Result<TOk, TError> |
result |
|
Action<TOk> |
action |
|
Returns
Type |
Description |
Result<TOk, TError> |
|
Type Parameters
Name |
Description |
TOk |
|
TError |
|
|
Improve this Doc
View Source
IterAsync<TOk, TError>(Result<TOk, TError>, Func<TOk, ValueTask>)
Declaration
public static async ValueTask<Result<TOk, TError>> IterAsync<TOk, TError>(this Result<TOk, TError> result, Func<TOk, ValueTask> actionAsync)
Parameters
Type |
Name |
Description |
Result<TOk, TError> |
result |
|
Func<TOk, ValueTask> |
actionAsync |
|
Returns
Type |
Description |
ValueTask<Result<TOk, TError>> |
|
Type Parameters
Name |
Description |
TOk |
|
TError |
|
|
Improve this Doc
View Source
IterError<TOk, TError>(Result<TOk, TError>, Action<TError>)
Declaration
public static Result<TOk, TError> IterError<TOk, TError>(this Result<TOk, TError> result, Action<TError> f)
Parameters
Type |
Name |
Description |
Result<TOk, TError> |
result |
|
Action<TError> |
f |
|
Returns
Type |
Description |
Result<TOk, TError> |
|
Type Parameters
Name |
Description |
TOk |
|
TError |
|
|
Improve this Doc
View Source
Map<TOkA, TOkB, TError>(Result<TOkA, TError>, Func<TOkA, TOkB>)
Declaration
public static Result<TOkB, TError> Map<TOkA, TOkB, TError>(this Result<TOkA, TError> result, Func<TOkA, TOkB> f)
Parameters
Type |
Name |
Description |
Result<TOkA, TError> |
result |
|
Func<TOkA, TOkB> |
f |
|
Returns
Type |
Description |
Result<TOkB, TError> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TError |
|
|
Improve this Doc
View Source
Map<TOkA, TOkB, TOkResult, TError>(Result<(TOkA, TOkB), TError>, Func<TOkA, TOkB, TOkResult>)
Declaration
public static Result<TOkResult, TError> Map<TOkA, TOkB, TOkResult, TError>(this Result<(TOkA, TOkB), TError> result, Func<TOkA, TOkB, TOkResult> f)
Parameters
Type |
Name |
Description |
Result<System.ValueTuple<TOkA, TOkB>, TError> |
result |
|
Func<TOkA, TOkB, TOkResult> |
f |
|
Returns
Type |
Description |
Result<TOkResult, TError> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TOkResult |
|
TError |
|
|
Improve this Doc
View Source
Map<TOkA, TOkB, TOkC, TOkResult, TError>(Result<(TOkA, TOkB, TOkC), TError>, Func<TOkA, TOkB, TOkC, TOkResult>)
Declaration
public static Result<TOkResult, TError> Map<TOkA, TOkB, TOkC, TOkResult, TError>(this Result<(TOkA, TOkB, TOkC), TError> result, Func<TOkA, TOkB, TOkC, TOkResult> f)
Parameters
Type |
Name |
Description |
Result<System.ValueTuple<TOkA, TOkB, TOkC>, TError> |
result |
|
Func<TOkA, TOkB, TOkC, TOkResult> |
f |
|
Returns
Type |
Description |
Result<TOkResult, TError> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TOkC |
|
TOkResult |
|
TError |
|
|
Improve this Doc
View Source
Map<TOkA, TOkB, TOkC, TOkD, TOkResult, TError>(Result<(TOkA, TOkB, TOkC, TOkD), TError>, Func<TOkA, TOkB, TOkC, TOkD, TOkResult>)
Declaration
public static Result<TOkResult, TError> Map<TOkA, TOkB, TOkC, TOkD, TOkResult, TError>(this Result<(TOkA, TOkB, TOkC, TOkD), TError> result, Func<TOkA, TOkB, TOkC, TOkD, TOkResult> f)
Parameters
Type |
Name |
Description |
Result<System.ValueTuple<TOkA, TOkB, TOkC, TOkD>, TError> |
result |
|
Func<TOkA, TOkB, TOkC, TOkD, TOkResult> |
f |
|
Returns
Type |
Description |
Result<TOkResult, TError> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TOkC |
|
TOkD |
|
TOkResult |
|
TError |
|
|
Improve this Doc
View Source
MapError<TOk, TErrorA, TErrorB>(Result<TOk, TErrorA>, Func<TErrorA, TErrorB>)
Declaration
public static Result<TOk, TErrorB> MapError<TOk, TErrorA, TErrorB>(this Result<TOk, TErrorA> result, Func<TErrorA, TErrorB> f)
Parameters
Type |
Name |
Description |
Result<TOk, TErrorA> |
result |
|
Func<TErrorA, TErrorB> |
f |
|
Returns
Type |
Description |
Result<TOk, TErrorB> |
|
Type Parameters
Name |
Description |
TOk |
|
TErrorA |
|
TErrorB |
|
|
Improve this Doc
View Source
MapErrorToSuccess<TOk, TError>(Result<TOk, TError>, Func<TError, TOk>)
Declaration
public static Result<TOk, TError> MapErrorToSuccess<TOk, TError>(this Result<TOk, TError> result, Func<TError, TOk> f)
Parameters
Type |
Name |
Description |
Result<TOk, TError> |
result |
|
Func<TError, TOk> |
f |
|
Returns
Type |
Description |
Result<TOk, TError> |
|
Type Parameters
Name |
Description |
TOk |
|
TError |
|
|
Improve this Doc
View Source
MapTask<TOkA, TOkB, TError>(Result<TOkA, TError>, Func<TOkA, Task<Result<TOkB, TError>>>)
Declaration
public static Task<Result<TOkB, TError>> MapTask<TOkA, TOkB, TError>(this Result<TOkA, TError> result, Func<TOkA, Task<Result<TOkB, TError>>> f)
Parameters
Type |
Name |
Description |
Result<TOkA, TError> |
result |
|
Func<TOkA, Task<Result<TOkB, TError>>> |
f |
|
Returns
Type |
Description |
Task<Result<TOkB, TError>> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TError |
|
|
Improve this Doc
View Source
SequenceTask<TOk, TError>(Result<Task<TOk>, TError>)
Declaration
public static async Task<Result<TOk, TError>> SequenceTask<TOk, TError>(this Result<Task<TOk>, TError> result)
Parameters
Type |
Name |
Description |
Result<Task<TOk>, TError> |
result |
|
Returns
Type |
Description |
Task<Result<TOk, TError>> |
|
Type Parameters
Name |
Description |
TOk |
|
TError |
|
|
Improve this Doc
View Source
SuccessContext<TOk, TError>(Result<TOk, TError>)
Declaration
public static TOk SuccessContext<TOk, TError>(this Result<TOk, TError> result)
Parameters
Type |
Name |
Description |
Result<TOk, TError> |
result |
|
Returns
Type Parameters
Name |
Description |
TOk |
|
TError |
|
|
Improve this Doc
View Source
ToError<TOk>(String)
Declaration
public static Result<TOk, string> ToError<TOk>(this string failedContext)
Parameters
Type |
Name |
Description |
System.String |
failedContext |
|
Returns
Type |
Description |
Result<TOk, System.String> |
|
Type Parameters
|
Improve this Doc
View Source
ToError<TOk, TError>(TError)
Declaration
public static Result<TOk, TError> ToError<TOk, TError>(this TError failedContext)
Parameters
Type |
Name |
Description |
TError |
failedContext |
|
Returns
Type |
Description |
Result<TOk, TError> |
|
Type Parameters
Name |
Description |
TOk |
|
TError |
|
|
Improve this Doc
View Source
ToOk<TOk>(TOk)
Declaration
public static Result<TOk, ValueTuple> ToOk<TOk>(this TOk successContext)
Parameters
Type |
Name |
Description |
TOk |
successContext |
|
Returns
Type |
Description |
Result<TOk, ValueTuple> |
|
Type Parameters
|
Improve this Doc
View Source
ToOk<TOk, TError>(TOk)
Declaration
public static Result<TOk, TError> ToOk<TOk, TError>(this TOk successContext)
Parameters
Type |
Name |
Description |
TOk |
successContext |
|
Returns
Type |
Description |
Result<TOk, TError> |
|
Type Parameters
Name |
Description |
TOk |
|
TError |
|
|
Improve this Doc
View Source
ToOkWithStringError<TOk>(TOk)
Declaration
public static Result<TOk, string> ToOkWithStringError<TOk>(this TOk successContext)
Parameters
Type |
Name |
Description |
TOk |
successContext |
|
Returns
Type |
Description |
Result<TOk, System.String> |
|
Type Parameters
|
Improve this Doc
View Source
TraverseA<TOkA, TOkB, TError>(ICollection<TOkA>, Func<TOkA, Result<TOkB, TError>>)
Declaration
public static (Result<ICollection<TOkB>, TError> result, ICollection<TError> errors) TraverseA<TOkA, TOkB, TError>(this ICollection<TOkA> elems, Func<TOkA, Result<TOkB, TError>> f)
Parameters
Type |
Name |
Description |
ICollection<TOkA> |
elems |
|
Func<TOkA, Result<TOkB, TError>> |
f |
|
Returns
Type |
Description |
System.ValueTuple<Result<ICollection<TOkB>, TError>, ICollection<TError>> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TError |
|
|
Improve this Doc
View Source
TraverseA<TOkA, TOkB, TErrorA, TErrorB>(ICollection<TOkA>, Func<TOkA, Result<TOkB, TErrorA>>, Func<TErrorA, TErrorB>)
Declaration
public static (Result<ICollection<TOkB>, TErrorA> result, ICollection<TErrorB> errors) TraverseA<TOkA, TOkB, TErrorA, TErrorB>(this ICollection<TOkA> elems, Func<TOkA, Result<TOkB, TErrorA>> f, Func<TErrorA, TErrorB> ferr)
Parameters
Type |
Name |
Description |
ICollection<TOkA> |
elems |
|
Func<TOkA, Result<TOkB, TErrorA>> |
f |
|
Func<TErrorA, TErrorB> |
ferr |
|
Returns
Type |
Description |
System.ValueTuple<Result<ICollection<TOkB>, TErrorA>, ICollection<TErrorB>> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TErrorA |
|
TErrorB |
|
|
Improve this Doc
View Source
TraverseM<TOkA, TOkB, TError>(ICollection<TOkA>, Func<TOkA, Result<TOkB, TError>>)
Declaration
public static Result<ICollection<TOkB>, TError> TraverseM<TOkA, TOkB, TError>(this ICollection<TOkA> elems, Func<TOkA, Result<TOkB, TError>> f)
Parameters
Type |
Name |
Description |
ICollection<TOkA> |
elems |
|
Func<TOkA, Result<TOkB, TError>> |
f |
|
Returns
Type |
Description |
Result<ICollection<TOkB>, TError> |
|
Type Parameters
Name |
Description |
TOkA |
|
TOkB |
|
TError |
|
|
Improve this Doc
View Source
TryGetFailedContext<TOk, TError>(Result<TOk, TError>, out TError)
Declaration
public static bool TryGetFailedContext<TOk, TError>(this Result<TOk, TError> result, out TError failedContext)
Parameters
Type |
Name |
Description |
Result<TOk, TError> |
result |
|
TError |
failedContext |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
Name |
Description |
TOk |
|
TError |
|
|
Improve this Doc
View Source
TryGetSuccessContext<TOk, TError>(Result<TOk, TError>, out TOk)
Declaration
public static bool TryGetSuccessContext<TOk, TError>(this Result<TOk, TError> result, out TOk successContext)
Parameters
Type |
Name |
Description |
Result<TOk, TError> |
result |
|
TOk |
successContext |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
Name |
Description |
TOk |
|
TError |
|