常见异常类型

1、System.Exception  最泛化的异常,所有在异常类型都从它派生

2、System.ArgumentException  传给方法的一个参数无效

3、System.ArgumentNullException  一个不应该为null的参数为null

4、System.ApplicationException  一个自定义的应用程序错误

5、System.FormatException  参数格式不符合调用的方法的参数规范

6、System.IndexOutOfRangeException  试图访问一个不存在的数组元素

7、System.InvalidCastException  因无效的类型转换或显式转换引发的异常

8、System.NotImplementedException  虽然找到了对应的方法签名,但是该方法尚未完全实现

9、System.NullReferenceException  试图访问尚未包含任何数据的一个变量

10、System.ArithmeticException  发生了一个无效的数学运算,但其中不包括被零除

11、System.ArrayTypeMismatchException  试图将类型有误的元素存储到数组中

12、System.StackOverflowException  通常意味着一个无限循环,方法不停的回调自身(称为递归)

原文地址:https://www.cnblogs.com/changweihua/p/2004163.html