.NET 常用类与异常类型解析
1. SystemException 类
SystemException 类是表示 .NET 运行时错误的异常基类。与之相对,ApplicationException 是用户自定义异常的基类。以下是其代码结构:
public class SystemException : Exception {
// Public Constructors
public method SystemException();
public method SystemException(string message);
public method SystemException(string message, Exception innerException);
// Protected Constructors
protected method SystemException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context);
}
其继承层次为:
graph LR
Object --> Exception(System.Runtime.Serialization.ISerializable)
Exception -->