c#的try-catch-finally

在编码过程中经常出现这样的代码

   int Tec()
   {
       int i = 0;
       try
       {
           int c = i / 0;
           return c;
       }
       catch
       {
           return 0;
       }
   }

 

 

  然后我们来看反编译后的代码

 编译器会把结果保存到一个result的中间变量中,然后最后统一返回

posted @ 2024-05-05 21:28  大大只植物  阅读(19)  评论(0)    收藏  举报