AggregateException 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 AggregateException 類別的新執行個體。
多載
| 名稱 | Description |
|---|---|
| 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 ,並以系統提供的訊息描述錯誤。
public:
AggregateException();
public AggregateException();
Public Sub New ()
備註
此建構器會將 Message 新實例的屬性初始化為系統提供的訊息,描述錯誤,例如「System.AggregateException: one or more error occurred」。此訊息考量了當前系統文化。
下表顯示了 的 AggregateException初始屬性值。
| 房產 | 價值 |
|---|---|
| InnerException |
null。 |
| Message | 區域化錯誤訊息字串。 |
另請參閱
適用於
AggregateException(IEnumerable<Exception>)
初始化該類別的新實例 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 論證是空的。
其中 innerExceptions 的元素是零元素。
適用於
AggregateException(Exception[])
初始化該類別的新實例 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 論證是空的。
其中 innerExceptions 的元素是零元素。
適用於
AggregateException(String)
初始化類別的新實例 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)
警告
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);
[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);
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);
[<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
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 論證是空的。
例外無法正確反序列化。
備註
此建構子在反序列化過程中被呼叫,以重建透過串流傳輸的例外物件。 欲了解更多資訊,請參閱 XML 與 SOAP 序列化。
另請參閱
適用於
AggregateException(String, IEnumerable<Exception>)
初始化類別的新實例 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 論證是空的。
其中 innerExceptions 的元素是零元素。
適用於
AggregateException(String, Exception)
初始化類別的新實例 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 論證是空的。
備註
因先前例外直接拋出的例外,應包含對該屬性中 InnerException 先前例外的參考。 該 InnerException 屬性回傳與傳入建構子相同的值,或 null 若該 InnerException 性質未提供內部例外值給建構子。
下表顯示了 的 AggregateException初始屬性值。
| 房產 | 價值 |
|---|---|
| InnerException |
null。 |
| Message | 錯誤訊息字串在 message中指定。 |
另請參閱
適用於
AggregateException(String, Exception[])
初始化類別的新實例 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 論證是空的。
其中 innerExceptions 的元素是零元素。