Partilhar via


PSObjectDisposedException Constructors

Definition

Overloads

PSObjectDisposedException(String)

Initializes a new instance of the PSObjectDisposedException class.

PSObjectDisposedException(SerializationInfo, StreamingContext)
Obsolete.

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

PSObjectDisposedException(String, Exception)

Initializes a new instance of the PSObjectDisposedException class.

PSObjectDisposedException(String, String)

Initializes a new instance of the PSObjectDisposedException class.

PSObjectDisposedException(String)

Initializes a new instance of the PSObjectDisposedException class.

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

Parameters

objectName
String

Remarks

Per MSDN, the parameter is objectName and not message. I confirm this experimentally as well. Also note that there is no parameterless constructor.

Applies to

PSObjectDisposedException(SerializationInfo, StreamingContext)

Caution

Legacy serialization support is deprecated since .NET 8

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

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

Parameters

info
SerializationInfo

Serialization information.

context
StreamingContext

Streaming context.

Attributes

Applies to

PSObjectDisposedException(String, Exception)

Initializes a new instance of the PSObjectDisposedException class.

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

Parameters

message
String
innerException
Exception

Applies to

PSObjectDisposedException(String, String)

Initializes a new instance of the PSObjectDisposedException class.

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

Parameters

objectName
String
message
String

Applies to