AggregateException 建構函式

定義

初始化 AggregateException 類別的新執行個體。

多載

AggregateException()

使用系統提供的錯誤描述訊息,初始化 AggregateException 類別的新執行個體。

AggregateException(IEnumerable<Exception>)

使用造成這個例外狀況原因的內部例外狀況參考,初始化 AggregateException 類別的新執行個體。

AggregateException(Exception[])

使用造成這個例外狀況原因的內部例外狀況參考,初始化 AggregateException 類別的新執行個體。

AggregateException(String)

初始化具有指定的錯誤描述訊息之 AggregateException 類別的新執行個體。

AggregateException(SerializationInfo, StreamingContext)
已淘汰.

使用序列化資料,初始化 AggregateException 類別的新執行個體。

AggregateException(String, IEnumerable<Exception>)

使用指定的錯誤訊息和造成這個例外狀況原因的內部例外狀況參考,初始化 AggregateException 類別的新執行個體。

AggregateException(String, Exception)

使用指定的錯誤訊息以及造成此例外狀況的內部例外狀況的參考,初始化 AggregateException 類別的新執行個體。

AggregateException(String, Exception[])

使用指定的錯誤訊息和造成這個例外狀況原因的內部例外狀況參考,初始化 AggregateException 類別的新執行個體。

AggregateException()

來源:
AggregateException.cs
來源:
AggregateException.cs
來源:
AggregateException.cs

使用系統提供的錯誤描述訊息,初始化 AggregateException 類別的新執行個體。

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

備註

這個建構函式會將新實例的 屬性初始化 Message 為系統提供的訊息,描述錯誤,例如「System.AggregateException:發生一或多個錯誤」。此訊息會將目前的系統文化特性納入考慮。

下表顯示 AggregateException 執行個體的初始屬性值。

屬性
InnerException null.
Message 當地語系化的錯誤訊息字串。

另請參閱

適用於

AggregateException(IEnumerable<Exception>)

來源:
AggregateException.cs
來源:
AggregateException.cs
來源:
AggregateException.cs

使用造成這個例外狀況原因的內部例外狀況參考,初始化 AggregateException 類別的新執行個體。

public:
 AggregateException(System::Collections::Generic::IEnumerable<Exception ^> ^ innerExceptions);
public AggregateException (System.Collections.Generic.IEnumerable<Exception> innerExceptions);
new AggregateException : seq<Exception> -> AggregateException
Public Sub New (innerExceptions As IEnumerable(Of Exception))

參數

innerExceptions
IEnumerable<Exception>

導致目前例外狀況的例外。

例外狀況

innerExceptions 引數為 null。

innerExceptions 的項目為 Null。

適用於

AggregateException(Exception[])

來源:
AggregateException.cs
來源:
AggregateException.cs
來源:
AggregateException.cs

使用造成這個例外狀況原因的內部例外狀況參考,初始化 AggregateException 類別的新執行個體。

public:
 AggregateException(... cli::array <Exception ^> ^ innerExceptions);
public AggregateException (params Exception[] innerExceptions);
new AggregateException : Exception[] -> AggregateException
Public Sub New (ParamArray innerExceptions As Exception())

參數

innerExceptions
Exception[]

導致目前例外狀況的例外。

例外狀況

innerExceptions 引數為 null。

innerExceptions 的項目為 Null。

適用於

AggregateException(String)

來源:
AggregateException.cs
來源:
AggregateException.cs
來源:
AggregateException.cs

初始化具有指定的錯誤描述訊息之 AggregateException 類別的新執行個體。

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

參數

message
String

說明例外狀況的訊息。 需要此建構函式的呼叫者,才能確保此字串已針對目前的系統文化特性進行當地語系化。

備註

下表顯示 AggregateException 執行個體的初始屬性值。

屬性
InnerException null.
Message message 中指定的錯誤訊息字串。

另請參閱

適用於

AggregateException(SerializationInfo, StreamingContext)

來源:
AggregateException.cs
來源:
AggregateException.cs
來源:
AggregateException.cs

警告

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

使用序列化資料,初始化 AggregateException 類別的新執行個體。

protected:
 AggregateException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected AggregateException (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 AggregateException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Security.SecurityCritical]
protected AggregateException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new AggregateException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> AggregateException
[<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 AggregateException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> AggregateException
[<System.Security.SecurityCritical>]
new AggregateException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> AggregateException
Protected Sub New (info As SerializationInfo, context As StreamingContext)

參數

info
SerializationInfo

存放序列物件資料的物件。

context
StreamingContext

關於來源或目的端的內容資訊。

屬性

例外狀況

info 引數為 null。

無法將例外狀況正確還原序列化。

備註

這個建構函式是在還原序列化期間呼叫,以便重新組成透過資料流傳輸的例外狀況物件。 如需詳細資訊,請參閱 < XML 和 SOAP 序列化

另請參閱

適用於

AggregateException(String, IEnumerable<Exception>)

來源:
AggregateException.cs
來源:
AggregateException.cs
來源:
AggregateException.cs

使用指定的錯誤訊息和造成這個例外狀況原因的內部例外狀況參考,初始化 AggregateException 類別的新執行個體。

public:
 AggregateException(System::String ^ message, System::Collections::Generic::IEnumerable<Exception ^> ^ innerExceptions);
public AggregateException (string message, System.Collections.Generic.IEnumerable<Exception> innerExceptions);
public AggregateException (string? message, System.Collections.Generic.IEnumerable<Exception> innerExceptions);
new AggregateException : string * seq<Exception> -> AggregateException
Public Sub New (message As String, innerExceptions As IEnumerable(Of Exception))

參數

message
String

解釋例外狀況原因的錯誤訊息。

innerExceptions
IEnumerable<Exception>

導致目前例外狀況的例外。

例外狀況

innerExceptions 引數為 null。

innerExceptions 的項目為 Null。

適用於

AggregateException(String, Exception)

來源:
AggregateException.cs
來源:
AggregateException.cs
來源:
AggregateException.cs

使用指定的錯誤訊息以及造成此例外狀況的內部例外狀況的參考,初始化 AggregateException 類別的新執行個體。

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

參數

message
String

說明例外狀況的訊息。 需要此建構函式的呼叫者,才能確保此字串已針對目前的系統文化特性進行當地語系化。

innerException
Exception

做為目前例外狀況發生原因的例外狀況。 如果 innerException 參數不是 null,則目前的例外狀況會在處理內部例外的 catch 區塊中引發。

例外狀況

innerException 引數為 null。

備註

被擲回以做為前一個例外狀況直接結果的例外狀況,應該在 InnerException 屬性中包含對前一個例外狀況的參考。 InnerException 屬性傳回的值會與傳入建構函式的值相同,或傳回 null (如果 InnerException 屬性未提供內部例外狀況值給建構函式)。

下表顯示 AggregateException 執行個體的初始屬性值。

屬性
InnerException null.
Message message 中指定的錯誤訊息字串。

另請參閱

適用於

AggregateException(String, Exception[])

來源:
AggregateException.cs
來源:
AggregateException.cs
來源:
AggregateException.cs

使用指定的錯誤訊息和造成這個例外狀況原因的內部例外狀況參考,初始化 AggregateException 類別的新執行個體。

public:
 AggregateException(System::String ^ message, ... cli::array <Exception ^> ^ innerExceptions);
public AggregateException (string message, params Exception[] innerExceptions);
public AggregateException (string? message, params Exception[] innerExceptions);
new AggregateException : string * Exception[] -> AggregateException
Public Sub New (message As String, ParamArray innerExceptions As Exception())

參數

message
String

解釋例外狀況原因的錯誤訊息。

innerExceptions
Exception[]

導致目前例外狀況的例外。

例外狀況

innerExceptions 引數為 null。

innerExceptions 的項目為 Null。

適用於