WindowsRuntimeSystemExtensions WindowsRuntimeSystemExtensions WindowsRuntimeSystemExtensions WindowsRuntimeSystemExtensions Class

定义

重要

此 API 不符合 CLS。

为在任务和 Windows 运行时异步操作之间转换提供扩展方法。Provides extension methods for converting between tasks and Windows Runtime asynchronous actions and operations.

public ref class WindowsRuntimeSystemExtensions abstract sealed
[System.CLSCompliant(false)]
[System.Security.SecurityCritical]
public static class WindowsRuntimeSystemExtensions
type WindowsRuntimeSystemExtensions = class
Public Module WindowsRuntimeSystemExtensions
继承
WindowsRuntimeSystemExtensionsWindowsRuntimeSystemExtensionsWindowsRuntimeSystemExtensionsWindowsRuntimeSystemExtensions
属性

注解

AsTask扩展方法重载使你能够使用.NETTask对象来管理从 Windows 运行时异步操作。The AsTask extension method overloads enable you to use a .NET Task object to manage an asynchronous operation from the Windows Runtime.

AsAsyncAction方法和AsAsyncOperation方法使您能够将任务状态传递给 Windows 运行时异步动作和操作的方法。The AsAsyncAction method and the AsAsyncOperation method enable you to pass started tasks to methods that take Windows Runtime asynchronous actions and operations. 另请参阅的方法AsyncInfo类。See also the methods of the AsyncInfo class.

GetAwaiter方法由编译器,用于实现操作 (在 Visual Basic 中)。The GetAwaiter methods are used by compilers to implement the operation ( in Visual Basic).

方法

AsAsyncAction(Task) AsAsyncAction(Task) AsAsyncAction(Task) AsAsyncAction(Task)

返回表示已开始任务的 Windows 运行时异步操作。Returns a Windows Runtime asynchronous action that represents a started task.

AsAsyncOperation<TResult>(Task<TResult>) AsAsyncOperation<TResult>(Task<TResult>) AsAsyncOperation<TResult>(Task<TResult>) AsAsyncOperation<TResult>(Task<TResult>)

返回表示返回结果的已开始任务的 Windows 运行时异步操作。Returns a Windows Runtime asynchronous operation that represents a started task that returns a result.

AsTask(IAsyncAction) AsTask(IAsyncAction) AsTask(IAsyncAction) AsTask(IAsyncAction)

返回表示 Windows 运行时异步操作的任务。Returns a task that represents a Windows Runtime asynchronous action.

AsTask(IAsyncAction, CancellationToken) AsTask(IAsyncAction, CancellationToken) AsTask(IAsyncAction, CancellationToken) AsTask(IAsyncAction, CancellationToken)

返回表示可以取消的 Windows 运行时异步操作的任务。Returns a task that represents a Windows Runtime asynchronous action that can be cancelled.

AsTask<TProgress>(IAsyncActionWithProgress<TProgress>) AsTask<TProgress>(IAsyncActionWithProgress<TProgress>) AsTask<TProgress>(IAsyncActionWithProgress<TProgress>) AsTask<TProgress>(IAsyncActionWithProgress<TProgress>)

返回表示 Windows 运行时异步操作的任务。Returns a task that represents a Windows Runtime asynchronous action.

AsTask<TProgress>(IAsyncActionWithProgress<TProgress>, IProgress<TProgress>) AsTask<TProgress>(IAsyncActionWithProgress<TProgress>, IProgress<TProgress>) AsTask<TProgress>(IAsyncActionWithProgress<TProgress>, IProgress<TProgress>) AsTask<TProgress>(IAsyncActionWithProgress<TProgress>, IProgress<TProgress>)

返回表示报告进度的 Windows 运行时异步操作的任务。Returns a task that represents a Windows Runtime asynchronous action that reports progress.

AsTask<TProgress>(IAsyncActionWithProgress<TProgress>, CancellationToken) AsTask<TProgress>(IAsyncActionWithProgress<TProgress>, CancellationToken) AsTask<TProgress>(IAsyncActionWithProgress<TProgress>, CancellationToken) AsTask<TProgress>(IAsyncActionWithProgress<TProgress>, CancellationToken)

返回表示可以取消的 Windows 运行时异步操作的任务。Returns a task that represents a Windows Runtime asynchronous action that can be cancelled.

AsTask<TProgress>(IAsyncActionWithProgress<TProgress>, CancellationToken, IProgress<TProgress>) AsTask<TProgress>(IAsyncActionWithProgress<TProgress>, CancellationToken, IProgress<TProgress>) AsTask<TProgress>(IAsyncActionWithProgress<TProgress>, CancellationToken, IProgress<TProgress>) AsTask<TProgress>(IAsyncActionWithProgress<TProgress>, CancellationToken, IProgress<TProgress>)

返回表示报告进度并可以取消的 Windows 运行时异步操作的任务。Returns a task that represents a Windows Runtime asynchronous action that reports progress and can be cancelled.

AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>, CancellationToken, IProgress<TProgress>) AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>, CancellationToken, IProgress<TProgress>) AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>, CancellationToken, IProgress<TProgress>) AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>, CancellationToken, IProgress<TProgress>)

返回表示返回结果、报告进度并可以取消的 Windows 运行时异步操作的任务。Returns a task that represents a Windows Runtime asynchronous operation that returns a result, reports progress, and can be cancelled.

AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>, CancellationToken) AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>, CancellationToken) AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>, CancellationToken) AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>, CancellationToken)

返回表示返回结果并可以取消的 Windows 运行时异步操作的任务。Returns a task that represents a Windows Runtime asynchronous operation that returns a result and can be cancelled.

AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>) AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>) AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>) AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>)

返回表示返回结果的 Windows 运行时异步操作的任务。Returns a task that represents a Windows Runtime asynchronous operation returns a result.

AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>, IProgress<TProgress>) AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>, IProgress<TProgress>) AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>, IProgress<TProgress>) AsTask<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>, IProgress<TProgress>)

返回表示返回结果并报告进度的 Windows 运行时异步操作的任务。Returns a task that represents Windows Runtime asynchronous operation that returns a result and reports progress.

AsTask<TResult>(IAsyncOperation<TResult>) AsTask<TResult>(IAsyncOperation<TResult>) AsTask<TResult>(IAsyncOperation<TResult>) AsTask<TResult>(IAsyncOperation<TResult>)

返回表示返回结果的 Windows 运行时异步操作的任务。Returns a task that represents a Windows Runtime asynchronous operation returns a result.

AsTask<TResult>(IAsyncOperation<TResult>, CancellationToken) AsTask<TResult>(IAsyncOperation<TResult>, CancellationToken) AsTask<TResult>(IAsyncOperation<TResult>, CancellationToken) AsTask<TResult>(IAsyncOperation<TResult>, CancellationToken)

返回表示返回结果并可以取消的 Windows 运行时异步操作的任务。Returns a task that represents a Windows Runtime asynchronous operation that returns a result and can be cancelled.

GetAwaiter(IAsyncAction) GetAwaiter(IAsyncAction) GetAwaiter(IAsyncAction) GetAwaiter(IAsyncAction)

此 API 支持 .NET Framework 基础结构,但不应在代码中直接使用。This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

GetAwaiter<TProgress>(IAsyncActionWithProgress<TProgress>) GetAwaiter<TProgress>(IAsyncActionWithProgress<TProgress>) GetAwaiter<TProgress>(IAsyncActionWithProgress<TProgress>) GetAwaiter<TProgress>(IAsyncActionWithProgress<TProgress>)

返回等待报告进度的异步操作对象。Returns an object that awaits an asynchronous action that reports progress.

GetAwaiter<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>) GetAwaiter<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>) GetAwaiter<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>) GetAwaiter<TResult,TProgress>(IAsyncOperationWithProgress<TResult,TProgress>)

返回等待报告进度并返回结果的异步操作的对象。Returns an object that awaits an asynchronous operation that reports progress and returns a result.

GetAwaiter<TResult>(IAsyncOperation<TResult>) GetAwaiter<TResult>(IAsyncOperation<TResult>) GetAwaiter<TResult>(IAsyncOperation<TResult>) GetAwaiter<TResult>(IAsyncOperation<TResult>)

返回等待返回结果的异步操作对象。Returns an object that awaits an asynchronous operation that returns a result.

适用于