mirror of
https://github.com/Cysharp/UniTask.git
synced 2026-05-20 22:50:16 +00:00
import from UniRx and some modified.
This commit is contained in:
23
Assets/UniRx.Async/Internal/Hack.cs
Normal file
23
Assets/UniRx.Async/Internal/Hack.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
#if NET_4_6 || NET_STANDARD_2_0 || CSHARP_7_OR_LATER
|
||||
|
||||
using System;
|
||||
|
||||
namespace UniRx.Async.Internal
|
||||
{
|
||||
internal static class FuncExtensions
|
||||
{
|
||||
// avoid lambda capture
|
||||
|
||||
internal static Action<T> AsFuncOfT<T>(this Action action)
|
||||
{
|
||||
return new Action<T>(action.Invoke);
|
||||
}
|
||||
|
||||
static void Invoke<T>(this Action action, T unused)
|
||||
{
|
||||
action();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user