static void WebClientDemo() { string str = null; using(WebClient wc=new WebClient()) { try { str = wc.DownloadString("http://www.albahari.com/nutshell/"); Console.WriteLine(str); } catch (WebException ex) when (ex.Status == WebExceptionStatus.Timeout) { Console.WriteLine("Timeout"); } } }
try catch exception when
猜你喜欢
转载自www.cnblogs.com/Fred1987/p/12733006.html
今日推荐
周排行