Search Results for

    Show / Hide Table of Contents

    Struct Result<T>

    Implements
    IResult
    Inherited Members
    System.ValueType.Equals(System.Object)
    System.ValueType.GetHashCode()
    ValueType.ToString()
    Object.Equals(Object, Object)
    Object.GetType()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Color_Chan.Discord.Core.Results
    Assembly: Color-Chan.Discord.Core.dll
    Syntax
    public readonly struct Result<T> : IResult
    Type Parameters
    Name Description
    T

    Properties

    | Improve this Doc View Source

    Entity

    The result entity.

    Declaration
    public readonly T Entity { get; }
    Property Value
    Type Description
    T
    | Improve this Doc View Source

    ErrorResult

    The error of the IResult.

    Declaration
    public readonly IErrorResult ErrorResult { get; }
    Property Value
    Type Description
    IErrorResult
    Remarks

    Null if the result doesn't have an inner result.

    | Improve this Doc View Source

    InnerResult

    The inner IResult.

    Declaration
    public readonly IResult InnerResult { get; }
    Property Value
    Type Description
    IResult
    Remarks

    Null if the IResult doesn't have an inner IResult.

    | Improve this Doc View Source

    IsSuccessful

    Whether or not the IResult is successful.

    Declaration
    public readonly bool IsSuccessful { get; }
    Property Value
    Type Description
    Boolean

    Methods

    | Improve this Doc View Source

    FromError(T, IErrorResult)

    Initializes a new unsuccessful instance of Result.

    Declaration
    public static Result<T> FromError(T entity, IErrorResult errorResult)
    Parameters
    Type Name Description
    T entity

    The T containing the result data.

    IErrorResult errorResult

    The IErrorResult containing the error details.

    Returns
    Type Description
    Result<T>

    The unsuccessful instance of Result.

    | Improve this Doc View Source

    FromError(T, IErrorResult, IResult)

    Initializes a new unsuccessful instance of Result.

    Declaration
    public static Result<T> FromError(T entity, IErrorResult errorResult, IResult innerResult)
    Parameters
    Type Name Description
    T entity

    The T containing the result data.

    IErrorResult errorResult

    The IErrorResult containing the error details.

    IResult innerResult

    The inner IResult.

    Returns
    Type Description
    Result<T>

    The unsuccessful instance of Result.

    | Improve this Doc View Source

    FromSuccess(T)

    Initializes a new successful instance of Result.

    Declaration
    public static Result<T> FromSuccess(T entity)
    Parameters
    Type Name Description
    T entity

    The T containing the result data.

    Returns
    Type Description
    Result<T>

    The successful instance of Result.

    Operators

    | Improve this Doc View Source

    Implicit(ErrorResult to Result<T>)

    Creates a Result<T> from an ErrorResult.

    Declaration
    public static implicit operator Result<T>(ErrorResult error)
    Parameters
    Type Name Description
    ErrorResult error

    The ErrorResult.

    Returns
    Type Description
    Result<T>

    The unsuccessful instance of Result.

    | Improve this Doc View Source

    Implicit(Exception to Result<T>)

    Creates a Result<T> with an Exception.

    Declaration
    public static implicit operator Result<T>(Exception exception)
    Parameters
    Type Name Description
    Exception exception

    The Exception.

    Returns
    Type Description
    Result<T>

    The unsuccessful instance of Result.

    Implements

    IResult
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX