mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 01:08:26 -04:00
21 lines
473 B
C#
21 lines
473 B
C#
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Threading.Tasks;
|
|
|
|
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(); }
|
|
}
|
|
|
|
}
|