• API Reference

    Show / Hide Table of Contents
    • Recore
      • AbsoluteUri
      • AsyncAction
      • AsyncAction<T>
      • AsyncAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>
      • AsyncAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>
      • AsyncAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>
      • AsyncAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>
      • AsyncAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>
      • AsyncAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>
      • AsyncAction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
      • AsyncAction<T1, T2, T3, T4, T5, T6, T7, T8, T9>
      • AsyncAction<T1, T2, T3, T4, T5, T6, T7, T8>
      • AsyncAction<T1, T2, T3, T4, T5, T6, T7>
      • AsyncAction<T1, T2, T3, T4, T5, T6>
      • AsyncAction<T1, T2, T3, T4, T5>
      • AsyncAction<T1, T2, T3, T4>
      • AsyncAction<T1, T2, T3>
      • AsyncAction<T1, T2>
      • AsyncDefer
      • AsyncFunc<T, TResult>
      • AsyncFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>
      • AsyncFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>
      • AsyncFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>
      • AsyncFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>
      • AsyncFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>
      • AsyncFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>
      • AsyncFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>
      • AsyncFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>
      • AsyncFunc<T1, T2, T3, T4, T5, T6, T7, T8, TResult>
      • AsyncFunc<T1, T2, T3, T4, T5, T6, T7, TResult>
      • AsyncFunc<T1, T2, T3, T4, T5, T6, TResult>
      • AsyncFunc<T1, T2, T3, T4, T5, TResult>
      • AsyncFunc<T1, T2, T3, T4, TResult>
      • AsyncFunc<T1, T2, T3, TResult>
      • AsyncFunc<T1, T2, TResult>
      • AsyncFunc<TResult>
      • Defer
      • Either
      • Either<TLeft, TRight>
      • Func
      • ObjectExtensions
      • Of<T>
      • OfJsonAttribute
      • Optional
      • Optional<T>
      • RelativeUri
      • Result
      • Result.AsyncCatcher<TValue>
      • Result.Catcher<TValue>
      • Result<TValue, TError>
      • Unit
      • UriExtensions
    • Recore.Collections.Generic
      • AnonymousEqualityComparer<T>
      • ICollectionExtensions
      • IDictionaryExtensions
      • IIterator<T>
      • Iterator
      • LinkedListExtensions
      • ListExtensions
      • MappedComparer<T, TMapped>
      • MappedEqualityComparer<T, TMapped>
    • Recore.Linq
      • Renumerable
    • Recore.Security.Cryptography
      • SecureCompare
    • Recore.Text.Json.Serialization.Converters
      • OverrideEitherConverter<TLeft, TRight>
      • OverrideResultConverter<TValue, TError>
    • Recore.Threading.Tasks
      • TaskExtensions

    Class Result

    Provides additional methods for Result<TValue, TError>.

    Inheritance
    Object
    Result
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Recore
    Assembly: Recore.dll
    Syntax
    public static class Result

    Methods

    | Improve this Doc View Source

    Collapse<T>(Result<T, T>)

    Retrieves the value of a Result<TValue, TError> when TValue and TError are the same.

    Declaration
    public static T Collapse<T>(this Result<T, T> result)
    Parameters
    Type Name Description
    Result<T, T> result
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Failure<TValue, TError>(TError)

    Creates a failed result.

    Declaration
    public static Result<TValue, TError> Failure<TValue, TError>(TError error)
    Parameters
    Type Name Description
    TError error
    Returns
    Type Description
    Result<TValue, TError>
    Type Parameters
    Name Description
    TValue
    TError
    | Improve this Doc View Source

    Failures<TValue, TError>(IEnumerable<Result<TValue, TError>>)

    Collects all the errors from failed results from the sequence.

    Declaration
    public static IEnumerable<TError> Failures<TValue, TError>(this IEnumerable<Result<TValue, TError>> source)
    Parameters
    Type Name Description
    IEnumerable<Result<TValue, TError>> source
    Returns
    Type Description
    IEnumerable<TError>
    Type Parameters
    Name Description
    TValue
    TError
    | Improve this Doc View Source

    Flatten<TValue, TError>(Result<Result<TValue, TError>, TError>)

    Converts a Result<Result<TValue, TError>, TError> to a Result<TValue, TError>.

    Declaration
    public static Result<TValue, TError> Flatten<TValue, TError>(this Result<Result<TValue, TError>, TError> resultResult)
    Parameters
    Type Name Description
    Result<Result<TValue, TError>, TError> resultResult
    Returns
    Type Description
    Result<TValue, TError>
    Type Parameters
    Name Description
    TValue
    TError
    | Improve this Doc View Source

    Success<TValue, TError>(TValue)

    Creates a successful result.

    Declaration
    public static Result<TValue, TError> Success<TValue, TError>(TValue value)
    Parameters
    Type Name Description
    TValue value
    Returns
    Type Description
    Result<TValue, TError>
    Type Parameters
    Name Description
    TValue
    TError
    | Improve this Doc View Source

    Successes<TValue, TError>(IEnumerable<Result<TValue, TError>>)

    Collects all the values of successful results from the sequence.

    Declaration
    public static IEnumerable<TValue> Successes<TValue, TError>(this IEnumerable<Result<TValue, TError>> source)
    Parameters
    Type Name Description
    IEnumerable<Result<TValue, TError>> source
    Returns
    Type Description
    IEnumerable<TValue>
    Type Parameters
    Name Description
    TValue
    TError
    | Improve this Doc View Source

    Try<TValue>(Func<TValue>)

    Suspends a function to be executed by Catch<TException>().

    Declaration
    public static Result.Catcher<TValue> Try<TValue>(Func<TValue> func)
    Parameters
    Type Name Description
    Func<TValue> func
    Returns
    Type Description
    Result.Catcher<TValue>
    Type Parameters
    Name Description
    TValue
    | Improve this Doc View Source

    TryAsync<TValue>(AsyncFunc<TValue>)

    Suspends a function to be executed by CatchAsync<TException>().

    Declaration
    public static Result.AsyncCatcher<TValue> TryAsync<TValue>(AsyncFunc<TValue> func)
    Parameters
    Type Name Description
    AsyncFunc<TValue> func
    Returns
    Type Description
    Result.AsyncCatcher<TValue>
    Type Parameters
    Name Description
    TValue
    Remarks

    TryAsync<TValue>(AsyncFunc<TValue>) must be used instead of Try<TValue>(Func<TValue>) to ensure exceptions are caught properly with async code.

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX