SslStream.DisposeAsync Method

Definition

Asynchronously releases the unmanaged and managed resources used by the SslStream.

C#
public override System.Threading.Tasks.ValueTask DisposeAsync();

Returns

A task that represents the asynchronous dispose operation.

Remarks

This method enables you to perform a resource-intensive dispose operation without blocking the main thread.

This method also disposes the inner stream when LeaveInnerStreamOpen is false; otherwise, the inner stream is just flushed.

Calling DisposeAsync allows the resources used by the SslStream to be reallocated for other purposes. For more information, see Cleaning Up Unmanaged Resources.

Applies to

Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.1