Skip to content

Ver 1.0.0

Compare
Choose a tag to compare
@neuecc neuecc released this 03 Jan 08:39
· 32 commits to master since this release

ValueTaskEx.Lazy returns AsyncLazy<T> instead of returns ValueTask<T> directly because follows IValueTaskSource guidance.

// AsyncLazy<T> is similar to Lazy<T>, it can store in field
// it await directly or can convert to ValueTask easily to use WhenAll.
public static AsyncLazy<T> Lazy<T>(Func<ValueTask<T>> factory)

public class AsyncLazy<T>
{
    public ValueTask<T> AsValueTask();
    public ValueTaskAwaiter<T> GetAwaiter();   
    public static implicit operator ValueTask<T>(AsyncLazy<T> source);
}