experiments/csharp/E030-AsyncVoid/Program.cs

17 lines
367 B
C#
Raw Normal View History

2024-05-04 20:16:52 +00:00
Foo();
Throw();
Console.WriteLine("You shouldn't see this because of the exception thrown in Throw, yet here we are.");
return;
static async void Foo()
{
await Task.Delay(1000);
Console.WriteLine("The output will not be written.");
}
static async void Throw()
{
await Task.Delay(1000);
throw new Exception("This exception will not be raised");
}