mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
18 lines
407 B
C#
18 lines
407 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Wabbajack.Common
|
|
{
|
|
public class AsyncLazy<T> : Lazy<Task<T>>
|
|
{
|
|
public AsyncLazy(Func<T> valueFactory) :
|
|
base(() => Task.Factory.StartNew(valueFactory))
|
|
{
|
|
}
|
|
|
|
public AsyncLazy(Func<Task<T>> taskFactory) :
|
|
base(() => Task.Factory.StartNew(taskFactory).Unwrap())
|
|
{
|
|
}
|
|
}
|
|
} |