Class TaskResult
Static helper methods to create TaskResult<T> instances.
Inheritance
Inherited Members
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. |
name | A string identifier for the TaskResult<T> |
System. |
result | The task that yields the result. |
System. |
ex | The exception to be returned when this TaskResult<T> is checked for errors. |
Returns
Type | Description |
---|---|
Task |
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. |
name | A string identifier for the TaskResult<T> |
System. |
result | The task that yields the result. |
System. |
ex | The exception to be returned when this TaskResult<T> is checked for errors. |
Returns
Type | Description |
---|---|
Task |
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. |
name | A string identifier for the TaskResult<T> |
System. |
description | A description of the task failed. |
System. |
result | The task that yields the result. |
System. |
ex | The exception to be returned when this TaskResult<T> is checked for errors. |
Returns
Type | Description |
---|---|
Task |
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. |
name | |
System. |
description | |
System. |
result | |
System. |
ex |
Returns
Type | Description |
---|---|
Task |
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. |
name | A string identifier for the TaskResult<T> |
System. |
result | The task that yields the result. |
Returns
Type | Description |
---|---|
Task |
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. |
name | A string identifier for the TaskResult<T> |
System. |
result | The task that yields the result. |
Returns
Type | Description |
---|---|
Task |
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. |
name | A string identifier for the TaskResult<T> |
System. |
description | A description of the task executed. |
System. |
result | The task that yields the result. |
Returns
Type | Description |
---|---|
Task |
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. |
name | A string identifier for the TaskResult<T> |
System. |
description | A description of the task executed. |
System. |
result | The task that yields the result. |
Returns
Type | Description |
---|---|
Task |
A TaskResult<T> that represents the yielded result. |
Type Parameters
Name | Description |
---|---|
TResult | The type of the result |