yes
Interviews6 answers
Can we use await in catch and finally blocks?
6 Answers
Bidyasagar MishraPosted Aug 4, 2019, 4:30 PM EDT
try
{
throw new Exception();
}
catch
{
await Task.Delay(1000); //using await in catch block
}
finally
{
await Task.Delay(1000); //using await in finally block
}
Binod KumarPosted Jun 28, 2019, 2:11 AM EDT
Yes, we can use await in catch and finally blocks in c# 6.0 onwards.
sushil kumarPosted Mar 7, 2019, 8:38 PM EST
yes
Sanjit Kumar SinghPosted May 4, 2018, 8:57 PM EDT
C# 6.0 came with another new feature along with Visual Studio 2015 and .NET 4.6. Now you will be able to write await operations in catch {} and finally {} blocks too.
Gajendra JangidPosted Jan 30, 2018, 10:01 PM EST
Yes, we can use it, from C# 6.0 onward. C# 6 was introduced with Visual Studio 2015. It supports using await in catch and finally blocks.
Dennis ThomasPosted Dec 17, 2017, 10:25 PM EST





