try catch finally
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