Επεξεργασία

Κοινή χρήση μέσω


Win32Exception Constructors

Definition

Initializes a new instance of the Win32Exception class.

Overloads

Win32Exception()

Initializes a new instance of the Win32Exception class with the last Win32 error that occurred.

Win32Exception(Int32)

Initializes a new instance of the Win32Exception class with the specified error.

Win32Exception(String)

Initializes a new instance of the Win32Exception class with the specified detailed description.

Win32Exception(Int32, String)

Initializes a new instance of the Win32Exception class with the specified error and the specified detailed description.

Win32Exception(SerializationInfo, StreamingContext)
Obsolete.

Initializes a new instance of the Win32Exception class with the specified context and the serialization information.

Win32Exception(String, Exception)

Initializes a new instance of the Win32Exception class with the specified detailed description and the specified exception.

Win32Exception()

Source:
Win32Exception.cs
Source:
Win32Exception.cs
Source:
Win32Exception.cs

Initializes a new instance of the Win32Exception class with the last Win32 error that occurred.

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

Remarks

The detailed description of the error will be determined by the Win32 error message associated with the error.

This constructor uses the GetLastWin32Error method of Marshal to get its error code.

Applies to

Win32Exception(Int32)

Source:
Win32Exception.cs
Source:
Win32Exception.cs
Source:
Win32Exception.cs

Initializes a new instance of the Win32Exception class with the specified error.

public:
 Win32Exception(int error);
public Win32Exception (int error);
new System.ComponentModel.Win32Exception : int -> System.ComponentModel.Win32Exception
Public Sub New (error As Integer)

Parameters

error
Int32

The Win32 error code associated with this exception.

Remarks

The detailed description of the error is determined by the Win32 error message associated with the error.

Applies to

Win32Exception(String)

Source:
Win32Exception.cs
Source:
Win32Exception.cs
Source:
Win32Exception.cs

Initializes a new instance of the Win32Exception class with the specified detailed description.

public:
 Win32Exception(System::String ^ message);
public Win32Exception (string message);
public Win32Exception (string? message);
new System.ComponentModel.Win32Exception : string -> System.ComponentModel.Win32Exception
Public Sub New (message As String)

Parameters

message
String

A detailed description of the error.

Applies to

Win32Exception(Int32, String)

Source:
Win32Exception.cs
Source:
Win32Exception.cs
Source:
Win32Exception.cs

Initializes a new instance of the Win32Exception class with the specified error and the specified detailed description.

public:
 Win32Exception(int error, System::String ^ message);
public Win32Exception (int error, string message);
public Win32Exception (int error, string? message);
new System.ComponentModel.Win32Exception : int * string -> System.ComponentModel.Win32Exception
Public Sub New (error As Integer, message As String)

Parameters

error
Int32

The Win32 error code associated with this exception.

message
String

A detailed description of the error.

Remarks

The detailed description of the error is determined by the Win32 error message associated with the error.

Applies to

Win32Exception(SerializationInfo, StreamingContext)

Source:
Win32Exception.cs
Source:
Win32Exception.cs
Source:
Win32Exception.cs

Caution

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

Initializes a new instance of the Win32Exception class with the specified context and the serialization information.

protected:
 Win32Exception(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected Win32Exception (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected Win32Exception (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.ComponentModel.Win32Exception : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.ComponentModel.Win32Exception
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.ComponentModel.Win32Exception : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.ComponentModel.Win32Exception
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parameters

info
SerializationInfo

The SerializationInfo associated with this exception.

context
StreamingContext

A StreamingContext that represents the context of this exception.

Attributes

Applies to

Win32Exception(String, Exception)

Source:
Win32Exception.cs
Source:
Win32Exception.cs
Source:
Win32Exception.cs

Initializes a new instance of the Win32Exception class with the specified detailed description and the specified exception.

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

Parameters

message
String

A detailed description of the error.

innerException
Exception

A reference to the inner exception that is the cause of this exception.

Applies to