异常捕获

再发生异常后,保持对程序的控制力

using System;
using System.Collections.Generic;
using System.Text;

namespace 异常捕获
{
    
class Program
    
{
        
static void Main(string[] args)
        
{
            
int a = 1;
            
int b = 0;
            
try
            
{
                a 
= a / b;
            }

            
catch (System.DivideByZeroException e)
            
{
                Console.WriteLine(e.Message);
            }

        }

    }

}

肩负责任,永不退缩
原文地址:https://www.cnblogs.com/ATP/p/860623.html