mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
16 lines
385 B
C#
16 lines
385 B
C#
using System.Runtime.CompilerServices;
|
|
|
|
namespace NadekoBot.Common;
|
|
|
|
public class AsyncLazy<T> : Lazy<Task<T>>
|
|
{
|
|
public AsyncLazy(Func<T> valueFactory) :
|
|
base(() => Task.Run(valueFactory))
|
|
{ }
|
|
|
|
public AsyncLazy(Func<Task<T>> taskFactory) :
|
|
base(() => Task.Run(taskFactory))
|
|
{ }
|
|
|
|
public TaskAwaiter<T> GetAwaiter() { return Value.GetAwaiter(); }
|
|
} |