Class DeferredProgress<T>
Remembers the latest call made to Report(T). Forwards that call (if any) and all future calls to a target IProgress<T> implementation once it is set.
Namespace: NanoByte.Common.Tasks
Assembly: NanoByte.Common.dll
Syntax
public class DeferredProgress<T> : Object
Type Parameters
Name | Description |
---|---|
T | The type of progress update value. |
Remarks
If Report(T) and SetTarget(IProgress<T>) are called on different threads individual progress reports may be lost. This tradeoff is made intentionally to avoid locking for better performance.
Constructors
DeferredProgress()
Declaration
public DeferredProgress()
Methods
Report(T)
Declaration
public void Report(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value |
SetTarget(IProgress<T>)
Sets the target IProgress<T> implementation to forward Report(T) calls to.
Declaration
public void SetTarget(IProgress<T> target)
Parameters
Type | Name | Description |
---|---|---|
IProgress<T> | target |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The target is already set. |