CodeThrowExceptionStatement クラス
アセンブリ: System (system.dll 内)

<SerializableAttribute> _ <ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ <ComVisibleAttribute(True)> _ Public Class CodeThrowExceptionStatement Inherits CodeStatement
[SerializableAttribute] [ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] [ComVisibleAttribute(true)] public class CodeThrowExceptionStatement : CodeStatement
[SerializableAttribute] [ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] [ComVisibleAttribute(true)] public ref class CodeThrowExceptionStatement : public CodeStatement

CodeThrowExceptionStatement は、例外をスローするステートメントを表すことができます。式は、Exception クラスから派生した型のインスタンス参照であるか、またはインスタンス参照として評価される必要があります。

CodeThrowExceptionStatement を使用して、新しい System.Exception をスローする例を次に示します。
' This CodeThrowExceptionStatement throws a new System.Exception. ' The codeExpression parameter indicates the exception to throw. ' You must use an object create expression to new an exception here. Dim throwException As New CodeThrowExceptionStatement( _ New CodeObjectCreateExpression( _ New CodeTypeReference(GetType(System.Exception)), _ New CodeExpression() {})) ' A Visual Basic code generator produces the following source code for the preceeding example code: ' Throw New System.Exception
// This CodeThrowExceptionStatement throws a new System.Exception. CodeThrowExceptionStatement throwException = new CodeThrowExceptionStatement( // codeExpression parameter indicates the exception to throw. // You must use an object create expression to new an exception here. new CodeObjectCreateExpression( // createType parameter inidicates the type of object to create. new CodeTypeReference(typeof(System.Exception)), // parameters parameter indicates the constructor parameters. new CodeExpression[] {} ) ); // A C# code generator produces the following source code for the preceeding example code: // throw new System.Exception();
// This CodeThrowExceptionStatement throws a new System.Exception. array<CodeExpression^>^temp0; CodeThrowExceptionStatement^ throwException = gcnew CodeThrowExceptionStatement( gcnew CodeObjectCreateExpression( gcnew CodeTypeReference( System::Exception::typeid ),temp0 ) ); // A C# code generator produces the following source code for the preceeding example code: // throw new System.Exception();
// This CodeThrowExceptionStatement throws a new System.Exception. CodeThrowExceptionStatement throwException = new CodeThrowExceptionStatement( // codeExpression parameter indicates the exception to throw. // You must use an object create expression to new an exception here. new CodeObjectCreateExpression( // createType parameter inidicates the type of object to create. new CodeTypeReference(System.Exception.class.ToType()) , // parameters parameter indicates the constructor parameters. new CodeExpression[]{})); // A VJ# code generator produces the following source code for // the preceeding example code: // throw new System.Exception();

System.CodeDom.CodeObject
System.CodeDom.CodeStatement
System.CodeDom.CodeThrowExceptionStatement


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CodeThrowExceptionStatement コンストラクタ ()
アセンブリ: System (system.dll 内)


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CodeThrowExceptionStatement コンストラクタ (CodeExpression)
アセンブリ: System (system.dll 内)


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CodeThrowExceptionStatement コンストラクタ

名前 | 説明 |
---|---|
CodeThrowExceptionStatement () | CodeThrowExceptionStatement クラスの新しいインスタンスを初期化します。 |
CodeThrowExceptionStatement (CodeExpression) | 例外型のインスタンスを指定して、CodeThrowExceptionStatement クラスの新しいインスタンスを初期化します。 |

CodeThrowExceptionStatement プロパティ

名前 | 説明 | |
---|---|---|
![]() | EndDirectives | 終了ディレクティブを含む CodeDirectiveCollection オブジェクトを取得します。 ( CodeStatement から継承されます。) |
![]() | LinePragma | コード ステートメントのある行を取得または設定します。 ( CodeStatement から継承されます。) |
![]() | StartDirectives | 開始ディレクティブを含む CodeDirectiveCollection オブジェクトを取得します。 ( CodeStatement から継承されます。) |
![]() | ToThrow | スローする例外を取得または設定します。 |
![]() | UserData | 現在のオブジェクトのユーザー定義可能なデータを取得または設定します。 ( CodeObject から継承されます。) |

CodeThrowExceptionStatement メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

CodeThrowExceptionStatement メンバ
CodeThrowExceptionStatement データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | EndDirectives | 終了ディレクティブを含む CodeDirectiveCollection オブジェクトを取得します。(CodeStatement から継承されます。) |
![]() | LinePragma | コード ステートメントのある行を取得または設定します。 (CodeStatement から継承されます。) |
![]() | StartDirectives | 開始ディレクティブを含む CodeDirectiveCollection オブジェクトを取得します。(CodeStatement から継承されます。) |
![]() | ToThrow | スローする例外を取得または設定します。 |
![]() | UserData | 現在のオブジェクトのユーザー定義可能なデータを取得または設定します。(CodeObject から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- CodeThrowExceptionStatementのページへのリンク