taskcontinuationoptions.onlyonfaulted

122

taskcontinuationoptions.onlyonfaulted -

Task originalTask = Task.Run(() => throw new Exception());
Task continuationTask = originalTask.ContinueWith(t => Console.WriteLine(t.Exception), TaskContinuationOptions.OnlyOnFaulted);
continuationTask.Wait()
// Both tasks completed. No exception rethrown

Comments

Submit
0 Comments