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.

屬性Property Value
InnerException null 參考 (在 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.

屬性Property Value
InnerException null 參考 (在 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.

備註

進行還原序列化 (Deserialization) 期間會呼叫這個建構函式,以便重新構成經由資料流傳送的例外狀況物件。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.

屬性Property Value
InnerException null 參考 (在 Visual Basic 中為 Nothing)。A null reference (Nothing in Visual Basic).
Message 錯誤訊息字串。The error message string.
ParamName 參數名稱的字串。The parameter name string.

適用於