共用方式為


OperationCanceledException 建構函式

定義

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

多載

名稱 Description
OperationCanceledException()

初始化該類別的新實例 OperationCanceledException ,並發出系統提供的錯誤訊息。

OperationCanceledException(String)

初始化類別的新實例 OperationCanceledException 並指定錯誤訊息。

OperationCanceledException(CancellationToken)

初始化一個新的類別實例 OperationCanceledException ,並使用消去標記。

OperationCanceledException(SerializationInfo, StreamingContext)
已淘汰.

使用串行化數據,初始化 OperationCanceledException 類別的新實例。

OperationCanceledException(String, Exception)

初始化類別的新實例 OperationCanceledException ,並附上指定的錯誤訊息及導致該異常的內部例外的參考。

OperationCanceledException(String, CancellationToken)

初始化類別的新實例 OperationCanceledException ,並以指定的錯誤訊息及消去標記。

OperationCanceledException(String, Exception, CancellationToken)

初始化一個新的類別實例 OperationCanceledException ,包含指定的錯誤訊息、指向導致該異常的內部異常的參考,以及一個取消標記。

OperationCanceledException()

來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs

初始化該類別的新實例 OperationCanceledException ,並發出系統提供的錯誤訊息。

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

備註

此建構子將新實例的屬性初始 Message 化為系統提供的訊息,描述錯誤,例如「操作被取消」。此訊息考量了當前系統文化。

下表顯示了 的 OperationCanceledException初始屬性值。

房產 價值
InnerException 一個空參考(Nothing Visual Basic 中的 Nullreference)。
Message 區域化錯誤訊息字串。
CancellationToken 一個在未取消狀態下產生的取消標記。

另請參閱

適用於

OperationCanceledException(String)

來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs

初始化類別的新實例 OperationCanceledException 並指定錯誤訊息。

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

參數

message
String

描述錯誤的 String

備註

內容 message 是為了讓人類理解。 此建構器的呼叫者必須確保此字串已在目前系統文化中本地化。

下表顯示了 的 OperationCanceledException初始屬性值。

房產 價值
InnerException 一個空參考(Nothing Visual Basic 中的 Reference)。
Message 錯誤訊息字串。
CancellationToken 一個在未取消狀態下產生的取消標記。

另請參閱

適用於

OperationCanceledException(CancellationToken)

來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs

初始化一個新的類別實例 OperationCanceledException ,並使用消去標記。

public:
 OperationCanceledException(System::Threading::CancellationToken token);
public OperationCanceledException(System.Threading.CancellationToken token);
new OperationCanceledException : System.Threading.CancellationToken -> OperationCanceledException
Public Sub New (token As CancellationToken)

參數

token
CancellationToken

一個與被取消操作相關的取消令牌。

備註

此建構子將新實例的屬性初始 Message 化為系統提供的訊息,描述錯誤,例如「操作被取消」。此訊息考量了當前系統文化。

下表顯示了 的 OperationCanceledException初始屬性值。

房產 價值
InnerException 一個空參考(Nothing Visual Basic 中的 Nullreference)。
Message 區域化錯誤訊息字串。
CancellationToken token

另請參閱

適用於

OperationCanceledException(SerializationInfo, StreamingContext)

來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs

警告

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

使用串行化數據,初始化 OperationCanceledException 類別的新實例。

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

參數

info
SerializationInfo

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

context
StreamingContext

關於來源或目的地的上下文資訊。

屬性

備註

此建構子在反序列化過程中被呼叫,以重建透過串流傳輸的例外物件。 欲了解更多資訊,請參閱 XML 與 SOAP 序列化

另請參閱

適用於

OperationCanceledException(String, Exception)

來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs

初始化類別的新實例 OperationCanceledException ,並附上指定的錯誤訊息及導致該異常的內部例外的參考。

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

參數

message
String

錯誤訊息解釋了例外原因。

innerException
Exception

該例外即為當前例外的原因。 若 innerException 參數不 null為 ,則在處理內部異常的區塊中提出 catch 當前例外。

備註

內容 message 是為了讓人類理解。 此建構器的呼叫者必須確保此字串已在目前系統文化中本地化。

因先前例外直接拋出的例外,應包含對該屬性中 InnerException 先前例外的參考。 該 InnerException 屬性回傳與傳入建構子相同的值,或 null 若該 InnerException 性質未提供內部例外值給建構子。

下表顯示了 的 OperationCanceledException初始屬性值。

屬性類型 狀況
InnerException innerException
Message message
CancellationToken 一個在未取消狀態下產生的取消標記。

另請參閱

適用於

OperationCanceledException(String, CancellationToken)

來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs

初始化類別的新實例 OperationCanceledException ,並以指定的錯誤訊息及消去標記。

public:
 OperationCanceledException(System::String ^ message, System::Threading::CancellationToken token);
public OperationCanceledException(string message, System.Threading.CancellationToken token);
public OperationCanceledException(string? message, System.Threading.CancellationToken token);
new OperationCanceledException : string * System.Threading.CancellationToken -> OperationCanceledException
Public Sub New (message As String, token As CancellationToken)

參數

message
String

錯誤訊息解釋了例外原因。

token
CancellationToken

一個與被取消操作相關的取消令牌。

備註

內容 message 是為了讓人類理解。 此建構器的呼叫者必須確保此字串已在目前系統文化中本地化。

下表顯示了 的 OperationCanceledException初始屬性值。

房產 價值
InnerException 一個空參考(Nothing Visual Basic 中的 Reference)。
Message message
CancellationToken token

另請參閱

適用於

OperationCanceledException(String, Exception, CancellationToken)

來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs
來源:
OperationCanceledException.cs

初始化一個新的類別實例 OperationCanceledException ,包含指定的錯誤訊息、指向導致該異常的內部異常的參考,以及一個取消標記。

public:
 OperationCanceledException(System::String ^ message, Exception ^ innerException, System::Threading::CancellationToken token);
public OperationCanceledException(string message, Exception innerException, System.Threading.CancellationToken token);
public OperationCanceledException(string? message, Exception? innerException, System.Threading.CancellationToken token);
new OperationCanceledException : string * Exception * System.Threading.CancellationToken -> OperationCanceledException
Public Sub New (message As String, innerException As Exception, token As CancellationToken)

參數

message
String

錯誤訊息解釋了例外原因。

innerException
Exception

該例外即為當前例外的原因。 若 innerException 參數不 null為 ,則在處理內部異常的區塊中提出 catch 當前例外。

token
CancellationToken

一個與被取消操作相關的取消令牌。

備註

內容 message 是為了讓人類理解。 此建構器的呼叫者必須確保此字串已在目前系統文化中本地化。

因先前例外直接拋出的例外,應包含對該屬性中 InnerException 先前例外的參考。 該 InnerException 屬性回傳與傳入建構子相同的值,或 null 若該 InnerException 性質未提供內部例外值給建構子。

下表顯示了 的 OperationCanceledException初始屬性值。

屬性類型 狀況
InnerException innerException
Message message
CancellationToken token

另請參閱

適用於