首页 > 其他 > 详细

try catch finally

时间:2017-03-09 17:21:12      阅读:209      评论:0      收藏:0      [点我收藏+]

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace delegateDiff
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = 1;
            string b = "abc";
            string c = "";
            try
            {
                a = Convert.ToInt32(b);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                c = "123";
                Console.Write(c);
                Console.ReadKey();
            }
            
        }
    }
}

 输出结果是:会抛出异常,但是还会执行finally

try catch finally

原文:http://www.cnblogs.com/May-day/p/6431205.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!