Skip to content

Forget Method ​

Definition ​

  • Namespace: JASE.Extensions
  • Assembly: JASE.Primitives.dll

void Forget(Task task, Action<Exception> onError = null) ​

csharp
void Forget(Task task, Action<Exception> onError = null)

Safely executes a Task without awaiting it.

Parameters ​

NameDescription
onErrorOptional delegate invoked if the task throws an exception.
taskThe task to execute in a fire-and-forget manner.

Remarks ​

This method observes the task to ensure that any exception is caught and optionally forwarded to the provided error handler. This prevents unobserved task exceptions when intentionally executing fire-and-forget asynchronous operations.