ValueSnapshot<T> Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides an asynchronously initialized value that:
- Can be awaited via GetValueAsync() until the first value or exception is set.
- Exposes the latest value after it has been set (supports re-setting).
- Tracks whether a value or exception was ever set via IsValueSet.
- Supports setting an exception that will be thrown by GetValueAsync.
Thread-safe for concurrent SetValue / SetException / GetValueAsync calls.
public sealed class ValueSnapshot<T>
type ValueSnapshot<'T> = class
Public NotInheritable Class ValueSnapshot(Of T)
Type Parameters
- T
- Inheritance
-
ValueSnapshot<T>
Constructors
| ValueSnapshot<T>() |
Properties
| IsValueSet |
True once a value or exception has been set at least once. |
Methods
| GetValueAsync(CancellationToken) |
Await the current value:
|
| SetException(Exception) |
Sets an exception that will be thrown by GetValueAsync. The first successful call (either SetValue or SetException) completes any pending GetValueAsync waiters. |
| SetValue(T) |
Sets (or updates) the value. The first successful call completes any pending GetValueAsync waiters. Subsequent calls replace the current value. |