共用方式為


CryptographicUnexpectedOperationException 建構函式

定義

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

多載

CryptographicUnexpectedOperationException()

使用預設屬性,初始化 CryptographicUnexpectedOperationException 類別的新執行個體。

CryptographicUnexpectedOperationException(String)

使用指定的錯誤訊息,初始化 CryptographicUnexpectedOperationException 類別的新執行個體。

CryptographicUnexpectedOperationException(SerializationInfo, StreamingContext)
已淘汰.

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

CryptographicUnexpectedOperationException(String, Exception)

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

CryptographicUnexpectedOperationException(String, String)

以指定的格式使用指定的錯誤訊息,初始化 CryptographicUnexpectedOperationException 類別的新執行個體。

CryptographicUnexpectedOperationException()

來源:
CryptographicUnexpectedOperationException.cs
來源:
CryptographicUnexpectedOperationException.cs
來源:
CryptographicUnexpectedOperationException.cs

使用預設屬性,初始化 CryptographicUnexpectedOperationException 類別的新執行個體。

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

範例

下列程式代碼範例示範如何建構 CryptographicUnexpectedOperationException 不含參數的 。 此程式代碼範例是提供給 類別之較大範例的 CryptographicUnexpectedOperationException 一部分。

CryptographicUnexpectedOperationException cryptographicException =
    new CryptographicUnexpectedOperationException();
Dim cryptographicException As _
    New CryptographicUnexpectedOperationException

備註

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

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

適用於

CryptographicUnexpectedOperationException(String)

來源:
CryptographicUnexpectedOperationException.cs
來源:
CryptographicUnexpectedOperationException.cs
來源:
CryptographicUnexpectedOperationException.cs

使用指定的錯誤訊息,初始化 CryptographicUnexpectedOperationException 類別的新執行個體。

public:
 CryptographicUnexpectedOperationException(System::String ^ message);
public CryptographicUnexpectedOperationException (string? message);
public CryptographicUnexpectedOperationException (string message);
new System.Security.Cryptography.CryptographicUnexpectedOperationException : string -> System.Security.Cryptography.CryptographicUnexpectedOperationException
Public Sub New (message As String)

參數

message
String

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

範例

下列程式代碼範例示範如何使用自訂錯誤訊息來建構 CryptographicUnexpectedOperationException 。 此程式代碼範例是提供給 類別之較大範例的 CryptographicUnexpectedOperationException 一部分。

string errorMessage = ("Unexpected operation exception.");
CryptographicUnexpectedOperationException cryptographicException =
    new CryptographicUnexpectedOperationException(errorMessage);
Dim errorMessage As String = "Unexpected operation exception."
Dim cryptographicException As _
    New CryptographicUnexpectedOperationException(errorMessage)

備註

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

屬性
InnerException null.
Message 錯誤訊息字串。

適用於

CryptographicUnexpectedOperationException(SerializationInfo, StreamingContext)

來源:
CryptographicUnexpectedOperationException.cs
來源:
CryptographicUnexpectedOperationException.cs
來源:
CryptographicUnexpectedOperationException.cs

警告

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

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

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

參數

info
SerializationInfo

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

context
StreamingContext

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

屬性

備註

這個建構函式是在還原序列化期間呼叫,以便重新組成透過資料流傳輸的例外狀況物件。

適用於

CryptographicUnexpectedOperationException(String, Exception)

來源:
CryptographicUnexpectedOperationException.cs
來源:
CryptographicUnexpectedOperationException.cs
來源:
CryptographicUnexpectedOperationException.cs

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

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

參數

message
String

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

inner
Exception

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

範例

下列程式代碼範例示範如何使用自訂錯誤訊息和內部例外狀況來建構 CryptographicUnexpectedOperationException 。 此程式代碼範例是提供給 類別之較大範例的 CryptographicUnexpectedOperationException 一部分。

string errorMessage = ("The current operation is not supported.");
NullReferenceException nullException = new NullReferenceException();
CryptographicUnexpectedOperationException cryptographicException = 
    new CryptographicUnexpectedOperationException(
    errorMessage, nullException);
Dim errorMessage As String = "The current operation is not supported."
Dim nullException As New NullReferenceException
Dim cryptographicException As _
    New CryptographicUnexpectedOperationException( _
    errorMessage, nullException)

備註

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

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

屬性
InnerException 內部例外狀況參考。
Message 錯誤訊息字串。

另請參閱

適用於

CryptographicUnexpectedOperationException(String, String)

來源:
CryptographicUnexpectedOperationException.cs
來源:
CryptographicUnexpectedOperationException.cs
來源:
CryptographicUnexpectedOperationException.cs

以指定的格式使用指定的錯誤訊息,初始化 CryptographicUnexpectedOperationException 類別的新執行個體。

public:
 CryptographicUnexpectedOperationException(System::String ^ format, System::String ^ insert);
public CryptographicUnexpectedOperationException (string format, string? insert);
public CryptographicUnexpectedOperationException (string format, string insert);
new System.Security.Cryptography.CryptographicUnexpectedOperationException : string * string -> System.Security.Cryptography.CryptographicUnexpectedOperationException
Public Sub New (format As String, insert As String)

參數

format
String

用來輸出錯誤訊息的格式。

insert
String

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

範例

下列程式代碼範例示範如何使用時間格式和目前日期來建構 CryptographicUnexpectedOperationException 。 此程式代碼範例是提供給 類別之較大範例的 CryptographicUnexpectedOperationException 一部分。

string dateFormat = "{0:t}";
string timeStamp = (DateTime.Now.ToString());
CryptographicUnexpectedOperationException cryptographicException = 
    new CryptographicUnexpectedOperationException(
    dateFormat, timeStamp);
Dim dateFormat As String = "{0:t}"
Dim timeStamp As String = DateTime.Now.ToString()
Dim cryptographicException As New _
    CryptographicUnexpectedOperationException(dateFormat, timeStamp)

備註

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

屬性
InnerException null.
Message 錯誤訊息字串。

適用於