• Home
  • Blog
  • Docs
  • GitHub
Show / Hide Table of Contents

Class TaskResult

Static helper methods to create TaskResult<T> instances.

Inheritance
System.Object
TaskResult
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()
Namespace: Snowflake.Installation
Assembly: Snowflake.Framework.Primitives.dll
Syntax
public static class TaskResult

Methods

Failure<TResult>(String, Task<TResult>, Exception)

Creates a failed TaskResult<T> with a System.Threading.Tasks.Task<TResult> that may or may not throw.

Declaration
public static TaskResult<TResult> Failure<TResult>(string name, Task<TResult> result, Exception ex)
Parameters
Type Name Description
System.String name

A string identifier for the TaskResult<T>

System.Threading.Tasks.Task<TResult> result

The task that yields the result.

System.Exception ex

The exception to be returned when this TaskResult<T> is checked for errors.

Returns
Type Description
TaskResult<TResult>

A TaskResult<T> that represents the yielded result, with the provided exception.

Type Parameters
Name Description
TResult

The type of the result

Failure<TResult>(String, ValueTask<TResult>, Exception)

Creates a failed TaskResult<T> with a System.Threading.Tasks.ValueTask<TResult> that may or may not throw.

Declaration
public static TaskResult<TResult> Failure<TResult>(string name, ValueTask<TResult> result, Exception ex)
Parameters
Type Name Description
System.String name

A string identifier for the TaskResult<T>

System.Threading.Tasks.ValueTask<TResult> result

The task that yields the result.

System.Exception ex

The exception to be returned when this TaskResult<T> is checked for errors.

Returns
Type Description
TaskResult<TResult>

A TaskResult<T> that represents the yielded result, with the provided exception.

Type Parameters
Name Description
TResult

The type of the result

Failure<TResult>(String, ValueTask<String>, Task<TResult>, Exception)

Creates a failed TaskResult<T> with a System.Threading.Tasks.Task<TResult> that may or may not throw.

Declaration
public static TaskResult<TResult> Failure<TResult>(string name, ValueTask<string> description, Task<TResult> result, Exception ex)
Parameters
Type Name Description
System.String name

A string identifier for the TaskResult<T>

System.Threading.Tasks.ValueTask<System.String> description

A description of the task failed.

System.Threading.Tasks.Task<TResult> result

The task that yields the result.

System.Exception ex

The exception to be returned when this TaskResult<T> is checked for errors.

Returns
Type Description
TaskResult<TResult>

A TaskResult<T> that represents the yielded result, with the provided exception.

Type Parameters
Name Description
TResult

The type of the result

Failure<TResult>(String, ValueTask<String>, ValueTask<TResult>, Exception)

Declaration
public static TaskResult<TResult> Failure<TResult>(string name, ValueTask<string> description, ValueTask<TResult> result, Exception ex)
Parameters
Type Name Description
System.String name
System.Threading.Tasks.ValueTask<System.String> description
System.Threading.Tasks.ValueTask<TResult> result
System.Exception ex
Returns
Type Description
TaskResult<TResult>
Type Parameters
Name Description
TResult

Success<TResult>(String, Task<TResult>)

Creates a TaskResult<T> with a non-throwing System.Threading.Tasks.Task<TResult>.

Declaration
public static TaskResult<TResult> Success<TResult>(string name, Task<TResult> result)
Parameters
Type Name Description
System.String name

A string identifier for the TaskResult<T>

System.Threading.Tasks.Task<TResult> result

The task that yields the result.

Returns
Type Description
TaskResult<TResult>

A TaskResult<T> that represents the yielded result.

Type Parameters
Name Description
TResult

The type of the result

Success<TResult>(String, ValueTask<TResult>)

Creates a TaskResult<T> with a non-throwing System.Threading.Tasks.ValueTask<TResult>.

Declaration
public static TaskResult<TResult> Success<TResult>(string name, ValueTask<TResult> result)
Parameters
Type Name Description
System.String name

A string identifier for the TaskResult<T>

System.Threading.Tasks.ValueTask<TResult> result

The task that yields the result.

Returns
Type Description
TaskResult<TResult>

A TaskResult<T> that represents the yielded result.

Type Parameters
Name Description
TResult

The type of the result

Success<TResult>(String, ValueTask<String>, Task<TResult>)

Creates a TaskResult<T> with a non-throwing System.Threading.Tasks.Task<TResult>.

Declaration
public static TaskResult<TResult> Success<TResult>(string name, ValueTask<string> description, Task<TResult> result)
Parameters
Type Name Description
System.String name

A string identifier for the TaskResult<T>

System.Threading.Tasks.ValueTask<System.String> description

A description of the task executed.

System.Threading.Tasks.Task<TResult> result

The task that yields the result.

Returns
Type Description
TaskResult<TResult>

A TaskResult<T> that represents the yielded result.

Type Parameters
Name Description
TResult

The type of the result

Success<TResult>(String, ValueTask<String>, ValueTask<TResult>)

Creates a TaskResult<T> with a non-throwing System.Threading.Tasks.ValueTask<TResult>.

Declaration
public static TaskResult<TResult> Success<TResult>(string name, ValueTask<string> description, ValueTask<TResult> result)
Parameters
Type Name Description
System.String name

A string identifier for the TaskResult<T>

System.Threading.Tasks.ValueTask<System.String> description

A description of the task executed.

System.Threading.Tasks.ValueTask<TResult> result

The task that yields the result.

Returns
Type Description
TaskResult<TResult>

A TaskResult<T> that represents the yielded result.

Type Parameters
Name Description
TResult

The type of the result

Built with ❤️ by @chyyran. Text content licensed under CC-BY-SA 4.0.