Struct Result
Assembly: Code.Library.dll
Syntax
[Serializable]
public struct Result : IResult, ISerializable
Fields
|
Improve this Doc
View Source
Declaration
public static bool DefaultConfigureAwait
Field Value
|
Improve this Doc
View Source
ErrorMessagesSeparator
Declaration
public static string ErrorMessagesSeparator
Field Value
Properties
|
Improve this Doc
View Source
Error
Declaration
public string Error { get; }
Property Value
|
Improve this Doc
View Source
IsFailure
Declaration
public bool IsFailure { get; }
Property Value
|
Improve this Doc
View Source
IsSuccess
Declaration
public bool IsSuccess { get; }
Property Value
Methods
|
Improve this Doc
View Source
Combine(params Result[])
Declaration
public static Result Combine(params Result[] results)
Parameters
| Type |
Name |
Description |
| Result[] |
results |
|
Returns
|
Improve this Doc
View Source
Combine(string, params Result[])
Returns failure which combined from all failures in the results list. Error messages are separated by errorMessagesSeparator.
If there is no failure returns success.
Declaration
public static Result Combine(string errorMessagesSeparator, params Result[] results)
Parameters
| Type |
Name |
Description |
| string |
errorMessagesSeparator |
Separator for error messages.
|
| Result[] |
results |
List of results.
|
Returns
|
Improve this Doc
View Source
Combine<T>(params Result<T>[])
Declaration
public static Result Combine<T>(params Result<T>[] results)
Parameters
| Type |
Name |
Description |
| Result<T>[] |
results |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Combine<T>(string, params Result<T>[])
Declaration
public static Result Combine<T>(string errorMessagesSeparator, params Result<T>[] results)
Parameters
| Type |
Name |
Description |
| string |
errorMessagesSeparator |
|
| Result<T>[] |
results |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Create(bool, string)
Declaration
public static Result Create(bool isSuccess, string error)
Parameters
Returns
|
Improve this Doc
View Source
Create(Func<bool>, string)
Declaration
public static Result Create(Func<bool> predicate, string error)
Parameters
Returns
|
Improve this Doc
View Source
Create(Func<Task<bool>>, string)
Declaration
public static Task<Result> Create(Func<Task<bool>> predicate, string error)
Parameters
Returns
|
Improve this Doc
View Source
Create<T>(bool, T, string)
Declaration
public static Result<T> Create<T>(bool isSuccess, T value, string error)
Parameters
| Type |
Name |
Description |
| bool |
isSuccess |
|
| T |
value |
|
| string |
error |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Create<T>(Func<bool>, T, string)
Declaration
public static Result<T> Create<T>(Func<bool> predicate, T value, string error)
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
Create<T>(Func<Task<bool>>, T, string)
Declaration
public static Task<Result<T>> Create<T>(Func<Task<bool>> predicate, T value, string error)
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
Create<T, E>(bool, T, E)
Declaration
public static Result<T, E> Create<T, E>(bool isSuccess, T value, E error) where E : class
Parameters
| Type |
Name |
Description |
| bool |
isSuccess |
|
| T |
value |
|
| E |
error |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Create<T, E>(Func<bool>, T, E)
Declaration
public static Result<T, E> Create<T, E>(Func<bool> predicate, T value, E error) where E : class
Parameters
| Type |
Name |
Description |
| Func<bool> |
predicate |
|
| T |
value |
|
| E |
error |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Create<T, E>(Func<Task<bool>>, T, E)
Declaration
public static Task<Result<T, E>> Create<T, E>(Func<Task<bool>> predicate, T value, E error) where E : class
Parameters
| Type |
Name |
Description |
| Func<Task<bool>> |
predicate |
|
| T |
value |
|
| E |
error |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Deconstruct(out bool, out bool)
Declaration
public void Deconstruct(out bool isSuccess, out bool isFailure)
Parameters
| Type |
Name |
Description |
| bool |
isSuccess |
|
| bool |
isFailure |
|
|
Improve this Doc
View Source
Deconstruct(out bool, out bool, out string)
Declaration
public void Deconstruct(out bool isSuccess, out bool isFailure, out string error)
Parameters
|
Improve this Doc
View Source
Fail(string)
Declaration
public static Result Fail(string error)
Parameters
| Type |
Name |
Description |
| string |
error |
|
Returns
|
Improve this Doc
View Source
Fail<T>(string)
Declaration
public static Result<T> Fail<T>(string error)
Parameters
| Type |
Name |
Description |
| string |
error |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Fail<T, E>(E)
Declaration
public static Result<T, E> Fail<T, E>(E error) where E : class
Parameters
| Type |
Name |
Description |
| E |
error |
|
Returns
Type Parameters
|
Improve this Doc
View Source
FirstFailureOrSuccess(params Result[])
Returns first failure in the list of results. If there is no failure returns success.
Declaration
public static Result FirstFailureOrSuccess(params Result[] results)
Parameters
| Type |
Name |
Description |
| Result[] |
results |
List of results.
|
Returns
|
Improve this Doc
View Source
Ok()
Declaration
public static Result Ok()
Returns
|
Improve this Doc
View Source
Ok<T>(T)
Declaration
public static Result<T> Ok<T>(T value)
Parameters
| Type |
Name |
Description |
| T |
value |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Ok<T, E>(T)
Declaration
public static Result<T, E> Ok<T, E>(T value) where E : class
Parameters
| Type |
Name |
Description |
| T |
value |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Try(Action, Func<Exception, string>)
Declaration
public static Result Try(Action action, Func<Exception, string> errorHandler = null)
Parameters
Returns
|
Improve this Doc
View Source
Try<T>(Func<Task<T>>, Func<Exception, string>)
Declaration
public static Task<Result<T>> Try<T>(Func<Task<T>> func, Func<Exception, string> errorHandler = null)
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
Try<T>(Func<T>, Func<Exception, string>)
Declaration
public static Result<T> Try<T>(Func<T> func, Func<Exception, string> errorHandler = null)
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
Try<T, E>(Func<Task<T>>, Func<Exception, E>)
Declaration
public static Task<Result<T, E>> Try<T, E>(Func<Task<T>> func, Func<Exception, E> errorHandler) where E : class
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
Try<T, E>(Func<T>, Func<Exception, E>)
Declaration
public static Result<T, E> Try<T, E>(Func<T> func, Func<Exception, E> errorHandler) where E : class
Parameters
Returns
Type Parameters
Implements
Extension Methods