





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






31
public static void ComputeTask(CancellationToken token) { for (int i=0; i<100000000; i++) token.ThrowIfCancellationRequested(); }
CancellationTokenSource cts = new CancellationTokenSource(); CancellationToken token = cts.Token; Task task = Task.Run(() => ComputeTask(token), token);
cts.Cancel(); // task.Wait();
Running Canceled Would throw AggregateException containing TaskCanceledException
32
34
static async Task
35
static async Task
static async Task<String[]> NcbiProteinParallelAsync(... ids) { var tasks = from id in ids select NcbiProteinAsync(id); return await Task.WhenAll(tasks); }
37
static async Task
38
static async Task