COMException Konstruktorer

Definition

Initierar en ny instans av COMException klassen.

Överlagringar

Name Description
COMException()

Initierar en ny instans av COMException klassen med standardvärden.

COMException(String)

Initierar en ny instans av COMException klassen med ett angivet meddelande.

COMException(SerializationInfo, StreamingContext)
Föråldrad.

Initierar en ny instans av COMException klassen från serialiseringsdata.

COMException(String, Exception)

Initierar en ny instans av COMException klassen med ett angivet felmeddelande och en referens till det inre undantaget som är orsaken till det här undantaget.

COMException(String, Int32)

Initierar en ny instans av COMException klassen med ett angivet meddelande och en felkod.

COMException()

Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs

Initierar en ny instans av COMException klassen med standardvärden.

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

Kommentarer

COMException ärver från ExternalException. Följande tabell visar hur konstruktorn anger objektets Exception egenskaper.

Fastighet Value
InnerException null.
Message En lokaliserad felmeddelandesträng.

Gäller för

COMException(String)

Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs

Initierar en ny instans av COMException klassen med ett angivet meddelande.

public:
 COMException(System::String ^ message);
public COMException(string message);
public COMException(string? message);
new System.Runtime.InteropServices.COMException : string -> System.Runtime.InteropServices.COMException
Public Sub New (message As String)

Parametrar

message
String

Meddelandet som anger orsaken till undantaget.

Kommentarer

COMException ärver från ExternalException. Följande tabell visar hur konstruktorn anger objektets Exception egenskaper.

Fastighet Value
InnerException null
Message message

Gäller för

COMException(SerializationInfo, StreamingContext)

Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs

Varning

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

Initierar en ny instans av COMException klassen från serialiseringsdata.

protected:
 COMException(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 COMException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
protected COMException(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}")>]
new System.Runtime.InteropServices.COMException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Runtime.InteropServices.COMException
new System.Runtime.InteropServices.COMException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Runtime.InteropServices.COMException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parametrar

info
SerializationInfo

Objektet SerializationInfo som innehåller serialiserade objektdata.

context
StreamingContext

Objektet StreamingContext som tillhandahåller kontextuell information om källan eller målet.

Attribut

Undantag

info är null.

Kommentarer

Den här konstruktorn anropas under deserialiseringen för att återskapa undantagsobjektet som överförs via en ström. Mer information finns i XML- och SOAP-serialisering.

COMException ärver från ExternalException.

Se även

Gäller för

COMException(String, Exception)

Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs

Initierar en ny instans av COMException klassen med ett angivet felmeddelande och en referens till det inre undantaget som är orsaken till det här undantaget.

public:
 COMException(System::String ^ message, Exception ^ inner);
public COMException(string message, Exception inner);
public COMException(string? message, Exception? inner);
new System.Runtime.InteropServices.COMException : string * Exception -> System.Runtime.InteropServices.COMException
Public Sub New (message As String, inner As Exception)

Parametrar

message
String

Felmeddelandet som förklarar orsaken till undantaget.

inner
Exception

Undantaget som är orsaken till det aktuella undantaget. Om parametern inner inte nullär genereras det aktuella undantaget i ett catch block som hanterar det inre undantaget.

Kommentarer

Ett undantag som genereras som ett direkt resultat av ett tidigare undantag bör innehålla en referens till det tidigare undantaget i InnerException egenskapen. Egenskapen InnerException returnerar samma värde som skickas till konstruktorn, eller null om InnerException egenskapen inte anger det inre undantagsvärdet till konstruktorn.

Följande tabell visar hur konstruktorn anger objektets Exception egenskaper.

Fastighet Value
InnerException Den inre undantagsreferensen.
Message Felmeddelandesträngen.

Se även

Gäller för

COMException(String, Int32)

Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs
Källa:
COMException.cs

Initierar en ny instans av COMException klassen med ett angivet meddelande och en felkod.

public:
 COMException(System::String ^ message, int errorCode);
public COMException(string message, int errorCode);
public COMException(string? message, int errorCode);
new System.Runtime.InteropServices.COMException : string * int -> System.Runtime.InteropServices.COMException
Public Sub New (message As String, errorCode As Integer)

Parametrar

message
String

Meddelandet som anger orsaken till att undantaget inträffade.

errorCode
Int32

Det felkodsvärde (HRESULT) som är associerat med det här undantaget.

Kommentarer

Den här COMException konstruktorn anger basmeddelandet med felkoden.

COMException ärver från ExternalException. Följande tabell visar hur konstruktorn anger objektets Exception egenskaper.

Fastighet Value
InnerException null
Message message

Gäller för