<PackageReference Include="SSH.NET" Version="2024.1.0" />

TaskToAsyncResult

static class TaskToAsyncResult
Provides methods for using Task to implement the Asynchronous Programming Model pattern based on "Begin" and "End" methods.
public static IAsyncResult Begin(Task task, AsyncCallback callback, object state)

Creates a new IAsyncResult from the specified Task, optionally invoking callback when the task has completed.

public static void End(IAsyncResult asyncResult)

Waits for the Task wrapped by the IAsyncResult returned by Begin to complete.

public static TResult End<TResult>(IAsyncResult asyncResult)

Waits for the Task<T> wrapped by the IAsyncResult returned by Begin to complete.

public static Task Unwrap(IAsyncResult asyncResult)

Extracts the underlying Task from an IAsyncResult created by Begin.

public static Task<TResult> Unwrap<TResult>(IAsyncResult asyncResult)

Extracts the underlying Task<T> from an IAsyncResult created by Begin.