Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
タスクの配列がある場合、Task[]. 配列内の 1 つ以上のタスクが失敗した (またはキャンセルされた) 場合にのみ実行される継続を作成するにはどうすればよいですか?
タスク の継続を設定するときに指定できる継続オプションを確認する必要があると思います。
Task<int> [] tasks = new Task<int>[5]; // Add tasks... foreach (var task in tasks) { task.ContinueWith(a => a.Id, TaskContinuationOptions.OnlyOnCanceled); } Task.WaitAny(tasks, new CancellationToken());