Class ManualResetValueTaskSource<TResult>
Represents an implementation of an object that can be wrapped by a ValueTask<TResult>.
public sealed class ManualResetValueTaskSource<TResult> : IValueTaskSource<TResult>
Type Parameters
TResult
The type of the result produced by the ManualResetValueTaskSource<TResult>.
- Inheritance
-
ManualResetValueTaskSource<TResult>
- Implements
-
IValueTaskSource<TResult>
- Inherited Members
- Extension Methods
Constructors
ManualResetValueTaskSource(bool)
Creates a new ManualResetValueTaskSource<TResult> instance.
public ManualResetValueTaskSource(bool runContinuationsAsynchronously = true)
Parameters
runContinuationsAsynchronously
boolSpecifies whether or not to force continuations to run asynchronously. Equal to true by default.
Properties
RunContinuationsAsynchronously
Specifies whether or not continuations are forced to run asynchronously.
public bool RunContinuationsAsynchronously { get; }
Property Value
Status
Specifies the status of this value task source's current operation.
public ValueTaskSourceStatus Status { get; }
Property Value
Methods
GetTask()
Creates a ValueTask<TResult> instance from this value task source.
public ValueTask<TResult> GetTask()
Returns
- ValueTask<TResult>
New ValueTask<TResult> instance.
Remarks
The returned value task will complete once this value task source is manually told to complete.
Reset()
Resets this value task source in order to prepare it for the next operation.
public void Reset()
SetCancelled(CancellationToken)
Completes this value task source's current operation with a cancellation.
public void SetCancelled(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationTokenCancellation token associated with the operation.
Exceptions
- InvalidOperationException
When current operation has already been completed.
SetException(Exception)
Completes this value task source's current operation with an error.
public void SetException(Exception error)
Parameters
error
ExceptionException of the operation.
Exceptions
- InvalidOperationException
When current operation has already been completed.
SetResult(TResult)
Completes this value task source's current operation with a successful result.
public void SetResult(TResult result)
Parameters
result
TResultResult of the operation.
Exceptions
- InvalidOperationException
When current operation has already been completed.
ToString()
Returns a string that represents the current object.
[Pure]
public override string ToString()
Returns
- string
A string that represents the current object.