C# try catch finally

2021-01-07 02:29

阅读:729

标签:bsp   exce   cat   console   catch   except   mamicode   load   http   

情形1: 

try
{
    int i = 0;
    i = int.Parse("t");
    Console.WriteLine("Try");
}
catch (Exception e)
{
    Console.WriteLine("Catch");
}
finally
{
    Console.WriteLine("Finally");
}

Console.WriteLine("End");

技术图片

情形2:  

try
{
    int i = 0;
    i = int.Parse("t");
Console.WriteLine("Try");   }
finally { Console.WriteLine("Finally"); } Console.WriteLine("End");

技术图片

 情形3:  

try
{
    int i = 0;
    i = int.Parse("t");
Console.WriteLine("Try"); }
catch (Exception e) { Console.WriteLine("Catch"); } Console.WriteLine("End");

技术图片

  情形4:  

try
{
    int i = 0;
    i = int.Parse("12");
Console.WriteLine("Try"); }
catch (Exception e) { Console.WriteLine("Catch"); } finally { Console.WriteLine("Finally"); } Console.WriteLine("End");

 技术图片

 情形5:

int i = 0;
i = int.Parse("t");

Console.WriteLine("End");

技术图片

 

C# try catch finally

标签:bsp   exce   cat   console   catch   except   mamicode   load   http   

原文地址:https://www.cnblogs.com/qinruijie/p/13156895.html


评论


亲,登录后才可以留言!