Search Results for

    Show / Hide Table of Contents
    View Source

    Class Attempt

    Provides ways to create attempts.

    Inheritance
    System.Object
    Namespace: Umbraco.Cms.Core
    Assembly: Umbraco.Core.dll
    Syntax
    public static class Attempt

    Methods

    View Source

    Fail<TResult>()

    Creates a failed attempt.

    Declaration
    public static Attempt<TResult> Fail<TResult>()
    Returns
    Type Description
    Attempt<TResult>

    The failed attempt.

    Type Parameters
    Name Description
    TResult

    The type of the attempted operation result.

    View Source

    Fail<TResult>(TResult)

    Creates a failed attempt with a result.

    Declaration
    public static Attempt<TResult> Fail<TResult>(TResult result)
    Parameters
    Type Name Description
    TResult result

    The result of the attempt.

    Returns
    Type Description
    Attempt<TResult>

    The failed attempt.

    Type Parameters
    Name Description
    TResult

    The type of the attempted operation result.

    View Source

    Fail<TResult>(TResult, Exception)

    Creates a failed attempt with a result and an exception.

    Declaration
    public static Attempt<TResult> Fail<TResult>(TResult result, Exception exception)
    Parameters
    Type Name Description
    TResult result

    The result of the attempt.

    Exception exception

    The exception causing the failure of the attempt.

    Returns
    Type Description
    Attempt<TResult>

    The failed attempt.

    Type Parameters
    Name Description
    TResult

    The type of the attempted operation result.

    View Source

    FailWithStatus<TResult, TStatus>(TStatus, TResult)

    Creates a failed attempt with a result and a status.

    Declaration
    public static Attempt<TResult, TStatus> FailWithStatus<TResult, TStatus>(TStatus status, TResult result)
    Parameters
    Type Name Description
    TStatus status

    The status of the attempt.

    TResult result

    The result of the attempt.

    Returns
    Type Description
    Attempt<TResult, TStatus>

    The failed attempt.

    Type Parameters
    Name Description
    TResult

    The type of the attempted operation result.

    TStatus

    The type of the attempted operation status.

    View Source

    FailWithStatus<TResult, TStatus>(TStatus, TResult, Exception)

    Creates a failed attempt with a result, an exception and a status.

    Declaration
    public static Attempt<TResult, TStatus> FailWithStatus<TResult, TStatus>(TStatus status, TResult result, Exception exception)
    Parameters
    Type Name Description
    TStatus status

    The status of the attempt.

    TResult result

    The result of the attempt.

    Exception exception

    The exception causing the failure of the attempt.

    Returns
    Type Description
    Attempt<TResult, TStatus>

    The failed attempt.

    Type Parameters
    Name Description
    TResult

    The type of the attempted operation result.

    TStatus

    The type of the attempted operation status.

    View Source

    If<TResult>(Boolean, TResult)

    Creates a successful or a failed attempt, with a result.

    Declaration
    public static Attempt<TResult> If<TResult>(bool condition, TResult result)
    Parameters
    Type Name Description
    System.Boolean condition

    A value indicating whether the attempt is successful.

    TResult result

    The result of the attempt.

    Returns
    Type Description
    Attempt<TResult>

    The attempt.

    Type Parameters
    Name Description
    TResult

    The type of the attempted operation result.

    View Source

    IfWithStatus<TResult, TStatus>(Boolean, TStatus, TStatus, TResult)

    Creates a successful or a failed attempt, with a result.

    Declaration
    public static Attempt<TResult, TStatus> IfWithStatus<TResult, TStatus>(bool condition, TStatus succStatus, TStatus failStatus, TResult result)
    Parameters
    Type Name Description
    System.Boolean condition

    A value indicating whether the attempt is successful.

    TStatus succStatus

    The status of the successful attempt.

    TStatus failStatus

    The status of the failed attempt.

    TResult result

    The result of the attempt.

    Returns
    Type Description
    Attempt<TResult, TStatus>

    The attempt.

    Type Parameters
    Name Description
    TResult

    The type of the attempted operation result.

    TStatus

    The type of the attempted operation status.

    View Source

    Succeed<TResult>(TResult)

    Creates a successful attempt with a result.

    Declaration
    public static Attempt<TResult> Succeed<TResult>(TResult result)
    Parameters
    Type Name Description
    TResult result

    The result of the attempt.

    Returns
    Type Description
    Attempt<TResult>

    The successful attempt.

    Type Parameters
    Name Description
    TResult

    The type of the attempted operation result.

    View Source

    SucceedWithStatus<TResult, TStatus>(TStatus, TResult)

    Creates a successful attempt with a result and a status.

    Declaration
    public static Attempt<TResult, TStatus> SucceedWithStatus<TResult, TStatus>(TStatus status, TResult result)
    Parameters
    Type Name Description
    TStatus status

    The status of the attempt.

    TResult result

    The result of the attempt.

    Returns
    Type Description
    Attempt<TResult, TStatus>

    The successful attempt.

    Type Parameters
    Name Description
    TResult

    The type of the attempted operation result.

    TStatus

    The type of the attempted operation status.

    • Improve this Doc
    • View Source
    In This Article
    • Methods
      • Fail<TResult>()
      • Fail<TResult>(TResult)
      • Fail<TResult>(TResult, Exception)
      • FailWithStatus<TResult, TStatus>(TStatus, TResult)
      • FailWithStatus<TResult, TStatus>(TStatus, TResult, Exception)
      • If<TResult>(Boolean, TResult)
      • IfWithStatus<TResult, TStatus>(Boolean, TStatus, TStatus, TResult)
      • Succeed<TResult>(TResult)
      • SucceedWithStatus<TResult, TStatus>(TStatus, TResult)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX