ArgumentNullException ArgumentNullException ArgumentNullException ArgumentNullException Constructors

定义

重载

ArgumentNullException() ArgumentNullException() ArgumentNullException()

初始化 ArgumentNullException 类的新实例。Initializes a new instance of the ArgumentNullException class.

ArgumentNullException(String) ArgumentNullException(String) ArgumentNullException(String) ArgumentNullException(String)

使用导致此异常的参数的名称初始化 ArgumentNullException 类的新实例。Initializes a new instance of the ArgumentNullException class with the name of the parameter that causes this exception.

ArgumentNullException(SerializationInfo, StreamingContext) ArgumentNullException(SerializationInfo, StreamingContext) ArgumentNullException(SerializationInfo, StreamingContext) ArgumentNullException(SerializationInfo, StreamingContext)

用序列化数据初始化 ArgumentNullException 类的新实例。Initializes a new instance of the ArgumentNullException class with serialized data.

ArgumentNullException(String, Exception) ArgumentNullException(String, Exception) ArgumentNullException(String, Exception) ArgumentNullException(String, Exception)

使用指定的错误消息和引发此异常的异常初始化 ArgumentNullException 类的新实例。Initializes a new instance of the ArgumentNullException class with a specified error message and the exception that is the cause of this exception.

ArgumentNullException(String, String) ArgumentNullException(String, String) ArgumentNullException(String, String) ArgumentNullException(String, String)

使用指定的错误消息和导致此异常的参数的名称来初始化 ArgumentNullException 类的实例。Initializes an instance of the ArgumentNullException class with a specified error message and the name of the parameter that causes this exception.

ArgumentNullException() ArgumentNullException() ArgumentNullException()

初始化 ArgumentNullException 类的新实例。Initializes a new instance of the ArgumentNullException class.

public:
 ArgumentNullException();
public ArgumentNullException ();
Public Sub New ()

注解

此构造函数初始化Message为系统提供的描述错误,例如"值不能为 null。"的消息的新实例的属性This constructor initializes the Message property of the new instance to a system-supplied message that describes the error, such as "Value cannot be null." 此消息将当前系统区域性考虑在内。This message takes into account the current system culture.

下表显示 ArgumentNullException 的实例的初始属性值。The following table shows the initial property values for an instance of ArgumentNullException.

PropertyProperty “值”Value
InnerException 空引用(在 Visual Basic 中为 Nothing)。A null reference (Nothing in Visual Basic).
Message 本地化的错误消息字符串,如"值不能为 null。"A localized error message string, such as "Value cannot be null." 针对英语。for the English language.

ArgumentNullException(String) ArgumentNullException(String) ArgumentNullException(String) ArgumentNullException(String)

使用导致此异常的参数的名称初始化 ArgumentNullException 类的新实例。Initializes a new instance of the ArgumentNullException class with the name of the parameter that causes this exception.

public:
 ArgumentNullException(System::String ^ paramName);
public ArgumentNullException (string paramName);
new ArgumentNullException : string -> ArgumentNullException
Public Sub New (paramName As String)

参数

paramName
String String String String

导致异常的参数的名称。The name of the parameter that caused the exception.

注解

此构造函数初始化Message属性为系统提供的描述错误并包括参数名称的消息的新实例。This constructor initializes the Message property of the new instance to a system-supplied message that describes the error and includes the parameter name. 此消息将当前系统区域性考虑在内。This message takes into account the current system culture.

此构造函数用 ParamName 参数初始化新实例的 paramName 属性。This constructor initializes the ParamName property of the new instance using the paramName parameter. paramName 的内容被设计为人可理解的形式。The content of paramName is intended to be understood by humans.

下表显示 ArgumentNullException 的实例的初始属性值。The following table shows the initial property values for an instance of ArgumentNullException.

PropertyProperty “值”Value
InnerException 空引用(在 Visual Basic 中为 Nothing)。A null reference (Nothing in Visual Basic).
Message 标识 null 参数的本地化的错误消息字符串。A localized error message string that identifies the null argument. 例如,如果paramName参数为"arg1"时,英语语言的消息字符串是:For example, if the paramName argument is "arg1", the English language message string is:

Value cannot be null.Parameter name: arg01
ParamName 参数名称字符串。The parameter name string.

ArgumentNullException(SerializationInfo, StreamingContext) ArgumentNullException(SerializationInfo, StreamingContext) ArgumentNullException(SerializationInfo, StreamingContext) ArgumentNullException(SerializationInfo, StreamingContext)

用序列化数据初始化 ArgumentNullException 类的新实例。Initializes a new instance of the ArgumentNullException class with serialized data.

protected:
 ArgumentNullException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
[System.Security.SecurityCritical]
protected ArgumentNullException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new ArgumentNullException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> ArgumentNullException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

参数

info
SerializationInfo SerializationInfo SerializationInfo SerializationInfo

承载序列化对象数据的对象。The object that holds the serialized object data.

context
StreamingContext StreamingContext StreamingContext StreamingContext

用于描述序列化数据的源或目标的对象。An object that describes the source or destination of the serialized data.

注解

此构造函数在反序列化过程中调用,以便重建通过流传输的异常对象。This constructor is called during deserialization to reconstitute the exception object transmitted over a stream. 有关详细信息,请参阅XML 和 SOAP 序列化For more information, see XML and SOAP Serialization.

安全性

SecurityPermission
用于提供序列化服务。for providing serialization services. 关联的枚举: SerializationFormatter 安全操作: LinkDemandAssociated enumeration: SerializationFormatter Security action: LinkDemand

SecurityCriticalAttribute
直接调用方需要完全信任。requires full trust for the immediate caller. 不能由部分受信任的或透明的代码使用此成员。This member cannot be used by partially trusted or transparent code.

另请参阅

ArgumentNullException(String, Exception) ArgumentNullException(String, Exception) ArgumentNullException(String, Exception) ArgumentNullException(String, Exception)

使用指定的错误消息和引发此异常的异常初始化 ArgumentNullException 类的新实例。Initializes a new instance of the ArgumentNullException class with a specified error message and the exception that is the cause of this exception.

public:
 ArgumentNullException(System::String ^ message, Exception ^ innerException);
public ArgumentNullException (string message, Exception innerException);
new ArgumentNullException : string * Exception -> ArgumentNullException
Public Sub New (message As String, innerException As Exception)

参数

message
String String String String

说明发生此异常的原因的错误消息。The error message that explains the reason for this exception.

innerException
Exception Exception Exception Exception

导致当前异常的异常;如果未指定内部异常,则是一个 null 引用(在 Visual Basic 中为 Nothing)。The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.

ArgumentNullException(String, String) ArgumentNullException(String, String) ArgumentNullException(String, String) ArgumentNullException(String, String)

使用指定的错误消息和导致此异常的参数的名称来初始化 ArgumentNullException 类的实例。Initializes an instance of the ArgumentNullException class with a specified error message and the name of the parameter that causes this exception.

public:
 ArgumentNullException(System::String ^ paramName, System::String ^ message);
public ArgumentNullException (string paramName, string message);
new ArgumentNullException : string * string -> ArgumentNullException
Public Sub New (paramName As String, message As String)

参数

paramName
String String String String

导致异常的参数的名称。The name of the parameter that caused the exception.

message
String String String String

描述错误的消息。A message that describes the error.

注解

此构造函数初始化Message属性使用的值的新实例的message参数。This constructor initializes the Message property of the new instance using the value of the message parameter. message 参数的内容应为人所理解。The content of the message parameter is intended to be understood by humans. 此构造函数的调用方需要确保此字符串已针对当前系统区域性进行了本地化。The caller of this constructor is required to ensure that this string has been localized for the current system culture.

此构造函数用 ParamName 参数初始化新实例的 paramName 属性。This constructor initializes the ParamName property of the new instance using the paramName parameter. paramName 的内容被设计为人可理解的形式。The content of paramName is intended to be understood by humans.

下表显示 ArgumentNullException 的实例的初始属性值。The following table shows the initial property values for an instance of ArgumentNullException.

PropertyProperty “值”Value
InnerException 空引用(在 Visual Basic 中为 Nothing)。A null reference (Nothing in Visual Basic).
Message 错误消息字符串。The error message string.
ParamName 参数名称字符串。The parameter name string.

适用于