Share via


TplExtensions.Forget Method

Definition

Overloads

Forget(Task)

Consumes a task and doesn't do anything with it. Useful for fire-and-forget calls to async methods within async methods.

Forget(ValueTask)

Consumes a ValueTask and allows it to be recycled, if applicable. Useful for fire-and-forget calls to async methods within async methods. NOTE: APIs should not generally return ValueTask if callers aren't 99.9999% likely to await the result immediately.

Forget<T>(ValueTask<T>)

Consumes a ValueTask and allows it to be recycled, if applicable. Useful for fire-and-forget calls to async methods within async methods. NOTE: APIs should not generally return ValueTask<TResult> if callers aren't 99.9999% likely to await the result immediately.

Forget(Task)

Consumes a task and doesn't do anything with it. Useful for fire-and-forget calls to async methods within async methods.

public:
[System::Runtime::CompilerServices::Extension]
 static void Forget(System::Threading::Tasks::Task ^ task);
public static void Forget (this System.Threading.Tasks.Task task);
public static void Forget (this System.Threading.Tasks.Task? task);
static member Forget : System.Threading.Tasks.Task -> unit
<Extension()>
Public Sub Forget (task As Task)

Parameters

task
Task

The task whose result is to be ignored.

Applies to

Forget(ValueTask)

Consumes a ValueTask and allows it to be recycled, if applicable. Useful for fire-and-forget calls to async methods within async methods. NOTE: APIs should not generally return ValueTask if callers aren't 99.9999% likely to await the result immediately.

public:
[System::Runtime::CompilerServices::Extension]
 static void Forget(System::Threading::Tasks::ValueTask task);
public static void Forget (this System.Threading.Tasks.ValueTask task);
static member Forget : System.Threading.Tasks.ValueTask -> unit
<Extension()>
Public Sub Forget (task As ValueTask)

Parameters

task
ValueTask

The task whose result is to be ignored.

Applies to

Forget<T>(ValueTask<T>)

Consumes a ValueTask and allows it to be recycled, if applicable. Useful for fire-and-forget calls to async methods within async methods. NOTE: APIs should not generally return ValueTask<TResult> if callers aren't 99.9999% likely to await the result immediately.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static void Forget(System::Threading::Tasks::ValueTask<T> task);
public static void Forget<T> (this System.Threading.Tasks.ValueTask<T> task);
static member Forget : System.Threading.Tasks.ValueTask<'T> -> unit
<Extension()>
Public Sub Forget(Of T) (task As ValueTask(Of T))

Type Parameters

T

The type of value produced by the task.

Parameters

task
ValueTask<T>

The task whose result is to be ignored.

Applies to