C# Exception:异常类
-
.NET Framework 类库中的所有异常都派生余Exception类,异常包括系统异常和应用异常。
-
系统异常包括IOException、NullReferenceException、OutOfMemoryException。
-
默认所有系统异常派生于System.SystemException,所有的应用程序异常派生余System.ApplicationException。
常用的系统异常类如下所示:
异常类 | 说明 |
---|---|
Syetem.IndexOutOfRangeException | 数组越界 |
System.ArithmaticException | 算术操作异常的基类 |
System.DivideByZeroException | 除零错误 |
System.OutOfMemoryException | 用 new 分配内存失败 |
System.StackOverflowException | 递归过多、过深 |
System.NullReferenceException | 对象为空 |