Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
1+4 =