Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Aggregate Exception
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; // aljodav // http://rextester.com/users/376 namespace Rextester { public class Program { public static void Main(string[] args) { try{ Foo(3).Wait(); // Foo(0) provokes a NON AggregateException. }catch(AggregateException ae){ Console.WriteLine("Aggregate Exception:"); foreach(var e in ae.Flatten().InnerExceptions){Console.WriteLine("\t"+e.Message);} }catch{ Console.WriteLine("other exception(s) caught in main."); }finally{ Console.WriteLine("Hello, world!"); } } public static Task Foo(int j){ if(j==0){throw new InvalidOperationException();} return Task.Run(()=>{ // eventually, will throw Divide By Zero Exception (will be caught in Main) for(int i=10;i>=0;--i){var v=j/i;Console.WriteLine(v);} }); } } }
run
|
edit
|
history
|
help
0
adxcsaxsd
a6
asaaaaa
defalt branch name
Binary Search Tree
eden
Found many section of times intersect (Question version)
circleTest
Sri 19 Sept
SunLocation