DeflateStream.DisposeAsync 方法


异步释放 DeflateStream 使用的非托管资源。Asynchronously releases the unmanaged resources used by the DeflateStream.

 override System::Threading::Tasks::ValueTask DisposeAsync();
public override System.Threading.Tasks.ValueTask DisposeAsync ();
override this.DisposeAsync : unit -> System.Threading.Tasks.ValueTask
Public Overrides Function DisposeAsync () As ValueTask


一个表示异步释放操作的任务。A task that represents the asynchronous dispose operation.


使用 DisposeAsync 方法,您可以在不阻塞主线程的情况下执行占用大量资源的释放操作。The DisposeAsync method enables you to perform a resource-intensive dispose operation without blocking the main thread. Windows 8.x 应用商店Windows 8.x Store 应用或 桌面desktop 应用中一个耗时的流操作可能阻塞 UI 线程并让您的应用看起来好像不工作时,这种性能的考虑就显得尤为重要了。This performance consideration is particularly important in a Windows 8.x 应用商店Windows 8.x Store app or 桌面desktop app where a time-consuming stream operation can block the UI thread and make your app appear as if it is not working. 异步方法与 Visual Basic 和C#中的 asyncawait 关键字结合使用。The async methods are used in conjunction with the async and await keywords in Visual Basic and C#.

此方法通过将任何更改写入后备存储并关闭流以释放资源来释放 Deflate 流。This method disposes the Deflate stream by writing any changes to the backing store and closing the stream to release resources.

调用 DisposeAsync 允许出于其他目的重新分配 DeflateStream 所使用的资源。Calling DisposeAsync allows the resources used by the DeflateStream to be reallocated for other purposes. 有关详细信息,请参阅清理非托管资源For more information, see Cleaning Up Unmanaged Resources.