Struct Unit
- Namespace
- PolyType.Abstractions
- Assembly
- PolyType.dll
Defines a type inhabited by a single value.
public readonly record struct Unit : IEquatable<Unit>
- Implements
- Inherited Members
Remarks
Used as a substitute for void in cases where it needs to be used as a type argument. See also https://en.wikipedia.org/wiki/Unit_type for more information.
Properties
Value
Gets the Unit instance.
public static Unit Value { get; }
Property Value
Methods
FromTaskAsync(Task)
Wraps a Task into a ValueTask<TResult>.
public static ValueTask<Unit> FromTaskAsync(Task task)
Parameters
task
TaskThe task to wrap.
Returns
- ValueTask<Unit>
A ValueTask<TResult> representing the asynchronous operation.
FromValueTaskAsync(ValueTask)
Wraps a ValueTask into a ValueTask<TResult>.
public static ValueTask<Unit> FromValueTaskAsync(ValueTask task)
Parameters
task
ValueTaskThe task to wrap.
Returns
- ValueTask<Unit>
A ValueTask<TResult> representing the asynchronous operation.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
ToTaskAsync(ValueTask<Unit>)
Wraps a ValueTask<TResult> into a Task.
public static Task ToTaskAsync(ValueTask<Unit> task)
Parameters
Returns
ToValueTaskAsync(ValueTask<Unit>)
Wraps a ValueTask<TResult> into a ValueTask.
public static ValueTask ToValueTaskAsync(ValueTask<Unit> task)