CryptographicException コンストラクター

定義

CryptographicException クラスの新しいインスタンスを初期化します。

オーバーロード

CryptographicException()

CryptographicException クラスの新しいインスタンスを、既定のプロパティを使用して初期化します。

CryptographicException(Int32)

HRESULT エラー コードを指定して、CryptographicException クラスの新しいインスタンスを初期化します。

CryptographicException(String)

指定したエラー メッセージを使用して、CryptographicException クラスの新しいインスタンスを初期化します。

CryptographicException(SerializationInfo, StreamingContext)
古い.

シリアル化したデータを使用して、CryptographicException クラスの新しいインスタンスを初期化します。

CryptographicException(String, Exception)

指定したエラー メッセージおよびこの例外の原因となった内部例外への参照を使用して、CryptographicException クラスの新しいインスタンスを初期化します。

CryptographicException(String, String)

エラー メッセージとその書式を指定して、CryptographicException クラスの新しいインスタンスを初期化します。

CryptographicException()

ソース:
CryptographicException.cs
ソース:
CryptographicException.cs
ソース:
CryptographicException.cs

CryptographicException クラスの新しいインスタンスを、既定のプロパティを使用して初期化します。

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

次のコード例では、パラメーターを使用しない を CryptographicException 構築する方法を示します。 このコード例は、CryptographicException クラスのために提供されている大規模な例の一部です。

CryptographicException^ cryptographicException = gcnew CryptographicException;
CryptographicException cryptographicException =
    new CryptographicException();
Dim cryptographicException As New CryptographicException

注釈

次の表に、CryptographicException のインスタンスに対するプロパティの初期値を示します。

プロパティ
InnerException null.
Message ローカライズされたエラー メッセージ文字列。

適用対象

CryptographicException(Int32)

ソース:
CryptographicException.cs
ソース:
CryptographicException.cs
ソース:
CryptographicException.cs

HRESULT エラー コードを指定して、CryptographicException クラスの新しいインスタンスを初期化します。

public:
 CryptographicException(int hr);
public CryptographicException (int hr);
new System.Security.Cryptography.CryptographicException : int -> System.Security.Cryptography.CryptographicException
Public Sub New (hr As Integer)

パラメーター

hr
Int32

HRESULT エラー コード。

次のコード例では、 のエラー コードを使用して を CryptographicException 構築する方法を CryptographicUnexpectedOperationException示します。 このコード例は、CryptographicException クラスのために提供されている大規模な例の一部です。

int exceptionNumber = (int)0x80131431;
CryptographicException^ cryptographicException = gcnew CryptographicException( exceptionNumber );
int exceptionNumber = unchecked((int)0x80131431);
CryptographicException cryptographicException =
    new CryptographicException(exceptionNumber);
Dim exceptionNumber As Integer = &H80131431
Dim cryptographicException As _
    New CryptographicException(exceptionNumber)

注釈

コンストラクターは CryptographicException システム HRESULT エラー コードを受け取り、 プロパティを Message に対応するローカライズされたメッセージに HRESULT設定します。

次の表に、CryptographicException のインスタンスに対するプロパティの初期値を示します。

プロパティ
InnerException null.
Message ローカライズされたエラー メッセージ文字列。

適用対象

CryptographicException(String)

ソース:
CryptographicException.cs
ソース:
CryptographicException.cs
ソース:
CryptographicException.cs

指定したエラー メッセージを使用して、CryptographicException クラスの新しいインスタンスを初期化します。

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

パラメーター

message
String

例外の原因を説明するエラー メッセージ。

次のコード例は、カスタム エラー メッセージを使用して を CryptographicException 構築する方法を示しています。 このコード例は、CryptographicException クラスのために提供されている大規模な例の一部です。

String^ errorMessage = (L"Unexpected Operation exception.");
CryptographicException^ cryptographicException = gcnew CryptographicException( errorMessage );
string errorMessage = ("Unexpected Operation exception.");
CryptographicException cryptographicException =
    new CryptographicException(errorMessage);
Dim errorMessage As String = "Unexpected Operation exception."
Dim cryptographicException As New CryptographicException(errorMessage)

注釈

次の表に、CryptographicException のインスタンスに対するプロパティの初期値を示します。

プロパティ
InnerException null.
Message エラー メッセージ文字列。

適用対象

CryptographicException(SerializationInfo, StreamingContext)

ソース:
CryptographicException.cs
ソース:
CryptographicException.cs
ソース:
CryptographicException.cs

注意事項

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

シリアル化したデータを使用して、CryptographicException クラスの新しいインスタンスを初期化します。

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

パラメーター

info
SerializationInfo

シリアル化されたオブジェクト データを保持するオブジェクト。

context
StreamingContext

転送元または転送先に関するコンテキスト情報。

属性

注釈

このコンストラクターは、シリアル化解除の際に呼び出されて、ストリームで送信された例外オブジェクトを再構成します。

適用対象

CryptographicException(String, Exception)

ソース:
CryptographicException.cs
ソース:
CryptographicException.cs
ソース:
CryptographicException.cs

指定したエラー メッセージおよびこの例外の原因となった内部例外への参照を使用して、CryptographicException クラスの新しいインスタンスを初期化します。

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

パラメーター

message
String

例外の原因を説明するエラー メッセージ。

inner
Exception

現在の例外の原因となった例外。 inner パラメーターが null でない場合は、内部例外を処理する catch ブロックで現在の例外が発生します。

次のコード例では、カスタム エラー メッセージと内部例外を使用して を CryptographicException 構築する方法を示します。 このコード例は、CryptographicException クラスのために提供されている大規模な例の一部です。

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

注釈

前の例外の直接の結果としてスローされる例外については、InnerException プロパティに、前の例外への参照を含める必要があります。 InnerException プロパティは、コンストラクターに渡されるのと同じ値を返します。または、InnerException プロパティがコンストラクターに内部例外値を提供しない場合には null を返します。

次の表に、CryptographicException のインスタンスに対するプロパティの初期値を示します。

プロパティ [値]
InnerException 内部例外の参照。
Message エラー メッセージ文字列。

こちらもご覧ください

適用対象

CryptographicException(String, String)

ソース:
CryptographicException.cs
ソース:
CryptographicException.cs
ソース:
CryptographicException.cs

エラー メッセージとその書式を指定して、CryptographicException クラスの新しいインスタンスを初期化します。

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

パラメーター

format
String

エラー メッセージの出力に使用する書式。

insert
String

例外の原因を説明するエラー メッセージ。

次のコード例では、時刻形式と現在の日付を使用して を CryptographicException 構築する方法を示します。 このコード例は、CryptographicException クラスのために提供されている大規模な例の一部です。

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

注釈

次の表に、CryptographicException のインスタンスに対するプロパティの初期値を示します。

プロパティ
InnerException null.
Message エラー メッセージ文字列。

適用対象