Await in catch block

前端 未结 9 1475
醉梦人生
醉梦人生 2020-11-28 11:14

I have the following code:

WebClient wc = new WebClient();
string result;
try
{
  result = await wc.DownloadStringTaskAsync( new Uri( \"http://badurl\" ) );
         


        
9条回答
  •  一整个雨季
    2020-11-28 11:41

    You could put the await after the catch block followed by a label, and put a goto in the try block. (No, really! Goto's aren't that bad!)

提交回复
热议问题