Progress<T> 类

定义

提供调用每个报告进度的值的回调的 IProgress<T>Provides an IProgress<T> that invokes callbacks for each reported progress value.

generic <typename T>
public ref class Progress : IProgress<T>
public class Progress<T> : IProgress<T>
type Progress<'T> = class
    interface IProgress<'T>
Public Class Progress(Of T)
Implements IProgress(Of T)

类型参数

T

指定进度报表值的类型。Specifies the type of the progress report value.

继承
Progress<T>
实现

注解

向构造函数或使用 ProgressChanged 事件注册的事件处理程序提供的任何处理程序都通过在构造实例时捕获的 SynchronizationContext 实例进行调用。Any handler provided to the constructor or event handlers registered with the ProgressChanged event are invoked through a SynchronizationContext instance captured when the instance is constructed. 如果在构造时没有当前 SynchronizationContext,则将对 ThreadPool调用回调。If there is no current SynchronizationContext at the time of construction, the callbacks will be invoked on the ThreadPool.

有关详细信息和代码示例,请参阅本文中的 Async in 4.5:在 .NET Framework 博客中的异步 api 中启用进度和取消For more information and a code example, see the article Async in 4.5: Enabling Progress and Cancellation in Async APIs in the .NET Framework blog.

构造函数

Progress<T>()

初始化 Progress<T> 对象。Initializes the Progress<T> object.

Progress<T>(Action<T>)

用指定的回调初始化 Progress<T> 对象。Initializes the Progress<T> object with the specified callback.

方法

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
OnReport(T)

报告进度更改。Reports a progress change.

ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

事件

ProgressChanged

为每个报告进度的值引发。Raised for each reported progress value.

显式接口实现

IProgress<T>.Report(T)

报告进度更改。Reports a progress change.

适用于