12345678910111213141516171819202122232425 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleTryCatch
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- try
- {
- object obj = null;
- int N = (int)obj;
- }
- catch (Exception ex)
- {
- Console.WriteLine("捕获异常:" + ex);
- }
- Console.ReadLine();
- }
- }
- }
|