TargetException Konstruktory

Definicja

Inicjuje nowe wystąpienie klasy TargetException.

Przeciążenia

Nazwa Opis
TargetException()

Inicjuje nowe wystąpienie TargetException klasy z pustym komunikatem i główną przyczyną wyjątku.

TargetException(String)

Inicjuje nowe wystąpienie TargetException klasy z danym komunikatem i główną przyczyną wyjątku.

TargetException(SerializationInfo, StreamingContext)
Przestarzałe.

Inicjuje nowe wystąpienie TargetException klasy z określonymi informacjami o serializacji i kontekście.

TargetException(String, Exception)

Inicjuje nowe wystąpienie TargetException klasy z określonym komunikatem o błędzie i odwołaniem do wyjątku wewnętrznego, który jest przyczyną tego wyjątku.

TargetException()

Źródło:
TargetException.cs
Źródło:
TargetException.cs
Źródło:
TargetException.cs
Źródło:
TargetException.cs
Źródło:
TargetException.cs

Inicjuje nowe wystąpienie TargetException klasy z pustym komunikatem i główną przyczyną wyjątku.

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

Uwagi

Właściwość jest ustawiona InnerException na null wartość , a kod błędu HRESULT jest ustawiony na COR_E_TARGET.

TargetException dziedziczy z elementu Exception. Ten konstruktor ustawia właściwości Exception obiektu, jak pokazano w poniższej tabeli.

Majątek Wartość
InnerException null
Message Pusty ciąg ("").

Dotyczy

TargetException(String)

Źródło:
TargetException.cs
Źródło:
TargetException.cs
Źródło:
TargetException.cs
Źródło:
TargetException.cs
Źródło:
TargetException.cs

Inicjuje nowe wystąpienie TargetException klasy z danym komunikatem i główną przyczyną wyjątku.

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

Parametry

message
String

Opis String przyczyny wystąpienia wyjątku.

Uwagi

TargetException dziedziczy z elementu Exception. Ten konstruktor ustawia właściwości Exception obiektu, jak pokazano w poniższej tabeli.

Majątek Wartość
InnerException null
Message Ciąg komunikatu.

Dotyczy

TargetException(SerializationInfo, StreamingContext)

Źródło:
TargetException.cs
Źródło:
TargetException.cs
Źródło:
TargetException.cs
Źródło:
TargetException.cs
Źródło:
TargetException.cs

Uwaga

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

Inicjuje nowe wystąpienie TargetException klasy z określonymi informacjami o serializacji i kontekście.

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

Parametry

info
SerializationInfo

Dane do serializacji lub deserializacji obiektu.

context
StreamingContext

Źródło obiektu i miejsce docelowe.

Atrybuty

Dotyczy

TargetException(String, Exception)

Źródło:
TargetException.cs
Źródło:
TargetException.cs
Źródło:
TargetException.cs
Źródło:
TargetException.cs
Źródło:
TargetException.cs

Inicjuje nowe wystąpienie TargetException klasy z określonym komunikatem o błędzie i odwołaniem do wyjątku wewnętrznego, który jest przyczyną tego wyjątku.

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

Parametry

message
String

Komunikat o błędzie wyjaśniający przyczynę wyjątku.

inner
Exception

Wyjątek, który jest przyczyną bieżącego wyjątku. Jeśli parametr inner nie jest null, bieżący wyjątek jest zgłaszany w bloku catch, który obsługuje wyjątek wewnętrzny.

Uwagi

Wyjątek zgłaszany bezpośrednio w wyniku poprzedniego wyjątku powinien zawierać odwołanie do poprzedniego wyjątku we właściwości InnerException. Właściwość InnerException zwraca tę samą wartość, która jest przekazywana do konstruktora, lub null, jeśli właściwość InnerException nie dostarcza wartości wyjątku wewnętrznego do konstruktora.

W poniższej tabeli przedstawiono początkowe wartości właściwości dla wystąpienia TargetException.

Majątek Wartość
InnerException Odwołanie do wyjątku wewnętrznego.
Message Ciąg komunikatu o błędzie.

Zobacz też

Dotyczy