ToDict, ToLookup, ToList, TOHashSet, ToObservable

This commit is contained in:
neuecc
2020-05-10 02:39:13 +09:00
parent f37cd703a9
commit 716decd199
20 changed files with 1133 additions and 5591 deletions

View File

@@ -31,15 +31,24 @@ namespace NetCoreSandbox
}
}
static async Task Main(string[] args)
static async IAsyncEnumerable<int> FooAsync([EnumeratorCancellation]CancellationToken cancellationToken = default)
{
new int[] { }.Aggregate((x, y) => x + y);
yield return 1;
await Task.Delay(10, cancellationToken);
}
static void Main(string[] args)
{
// Create Canceled token.
var cts = new CancellationTokenSource();
cts.Cancel();
// OK, don't throw.
var e1 = FooAsync(cts.Token).GetAsyncEnumerator(cts.Token);
Console.WriteLine("OK:FooAsyunc().GetAsyncEnumerator()");
await Task.Yield();
// Ix.Async LINQ Operator throws OperationCanceledException
var e2 = FooAsync(cts.Token).Select(x => x).GetAsyncEnumerator(cts.Token);
}