Files
UniTask/src/UniTask.NetCoreSandbox/Program.cs

51 lines
897 B
C#
Raw Normal View History

2020-06-29 03:02:23 +09:00
#pragma warning disable CS1998
using Cysharp.Threading.Tasks;
2020-05-08 03:23:14 +09:00
using System.Linq;
2020-05-05 21:05:32 +09:00
using System;
2020-05-08 03:23:14 +09:00
using System.Collections.Generic;
using System.Threading;
2020-05-05 21:05:32 +09:00
using System.Threading.Tasks;
2020-05-08 03:23:14 +09:00
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;
using System.Runtime.CompilerServices;
using Cysharp.Threading.Tasks.Linq;
2020-05-09 15:33:46 +09:00
using System.Reactive.Linq;
using System.Reactive.Concurrency;
2020-05-05 21:05:32 +09:00
namespace NetCoreSandbox
{
2021-08-27 16:44:05 +09:00
public class Program
2020-05-31 04:28:05 +09:00
{
2021-08-27 16:44:05 +09:00
static async Task Main(string[] args)
2020-05-31 04:28:05 +09:00
{
2021-08-27 16:44:05 +09:00
var cts = new CancellationTokenSource();
2020-05-31 04:28:05 +09:00
2021-08-27 16:44:05 +09:00
// OK.
await FooAsync(10, cts.Token);
2020-05-31 04:28:05 +09:00
2021-08-27 16:44:05 +09:00
// NG(Compiler Error)
await FooAsync(10);
2020-05-31 04:28:05 +09:00
2020-05-31 04:28:05 +09:00
2020-05-11 12:02:02 +09:00
2020-05-29 01:22:46 +09:00
}
2021-08-27 16:44:05 +09:00
static async UniTask FooAsync(int x, CancellationToken cancellationToken = default)
{
await UniTask.Yield();
}
2020-05-08 03:23:14 +09:00
}
2020-05-07 11:27:27 +09:00
2020-05-05 21:05:32 +09:00
}