码迷,mamicode.com
首页 > 其他好文 > 详细

try catch exception when

时间:2020-04-19 19:40:00      阅读:71      评论:0      收藏:0      [点我收藏+]

标签:dem   down   cli   nbsp   tde   when   nload   demo   try catch   

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

标签:dem   down   cli   nbsp   tde   when   nload   demo   try catch   

原文地址:https://www.cnblogs.com/Fred1987/p/12733006.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!