次の方法で共有


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.cs
ソース:
CryptographicException.cs

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

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

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

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

注釈

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

財産 価値
InnerException null
Message ローカライズされたエラー メッセージ文字列。

適用対象

CryptographicException(Int32)

ソース:
CryptographicException.cs
ソース:
CryptographicException.cs
ソース:
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エラー コード。

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

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.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 = ("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
ソース:
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);
[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);
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}")>]
new System.Security.Cryptography.CryptographicException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.Cryptography.CryptographicException
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.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 = ("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 プロパティは、コンストラクターに渡されるのと同じ値を返します。または、null プロパティがコンストラクターに内部例外値を提供しない場合はInnerExceptionします。

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

財産 価値
InnerException 内部例外参照。
Message エラー メッセージ文字列。

こちらもご覧ください

適用対象

CryptographicException(String, String)

ソース:
CryptographicException.cs
ソース:
CryptographicException.cs
ソース:
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 = "{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 エラー メッセージ文字列。

適用対象