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.

有关详细信息和代码示例,请参阅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()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

事件

ProgressChanged

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

显式界面实现

IProgress<T>.Report(T)

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

适用于