Share via


PSArgumentNullException Constructors

Definition

Overloads

PSArgumentNullException()

Initializes a new instance of the PSArgumentNullException class.

PSArgumentNullException(String)

Initializes a new instance of the PSArgumentNullException class.

PSArgumentNullException(SerializationInfo, StreamingContext)
Obsolete.

Initializes a new instance of the PSArgumentNullException class using data serialized via ISerializable

PSArgumentNullException(String, Exception)

Initializes a new instance of the PSArgumentNullException class.

PSArgumentNullException(String, String)

Initializes a new instance of the PSArgumentNullException class.

PSArgumentNullException()

Initializes a new instance of the PSArgumentNullException class.

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

Applies to

PSArgumentNullException(String)

Initializes a new instance of the PSArgumentNullException class.

public:
 PSArgumentNullException(System::String ^ paramName);
public:
 PSArgumentNullException(Platform::String ^ paramName);
 PSArgumentNullException(std::wstring const & paramName);
public PSArgumentNullException (string paramName);
new System.Management.Automation.PSArgumentNullException : string -> System.Management.Automation.PSArgumentNullException
Public Sub New (paramName As String)

Parameters

paramName
String

Remarks

Per MSDN, the parameter is paramName and not message. I confirm this experimentally as well.

Applies to

PSArgumentNullException(SerializationInfo, StreamingContext)

Caution

Legacy serialization support is deprecated since .NET 8

Initializes a new instance of the PSArgumentNullException class using data serialized via ISerializable

protected:
 PSArgumentNullException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected PSArgumentNullException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Obsolete("Legacy serialization support is deprecated since .NET 8", DiagnosticId="SYSLIB0051")]
protected PSArgumentNullException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Management.Automation.PSArgumentNullException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Management.Automation.PSArgumentNullException
[<System.Obsolete("Legacy serialization support is deprecated since .NET 8", DiagnosticId="SYSLIB0051")>]
new System.Management.Automation.PSArgumentNullException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Management.Automation.PSArgumentNullException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parameters

info
SerializationInfo

Serialization information.

context
StreamingContext

Streaming context.

Attributes

Applies to

PSArgumentNullException(String, Exception)

Initializes a new instance of the PSArgumentNullException class.

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

Parameters

message
String
innerException
Exception

Applies to

PSArgumentNullException(String, String)

Initializes a new instance of the PSArgumentNullException class.

public:
 PSArgumentNullException(System::String ^ paramName, System::String ^ message);
public:
 PSArgumentNullException(Platform::String ^ paramName, Platform::String ^ message);
 PSArgumentNullException(std::wstring const & paramName, std::wstring const & message);
public PSArgumentNullException (string paramName, string message);
new System.Management.Automation.PSArgumentNullException : string * string -> System.Management.Automation.PSArgumentNullException
Public Sub New (paramName As String, message As String)

Parameters

paramName
String
message
String

Remarks

ArgumentNullException has this ctor form and we imitate it here.

Applies to