CodeThrowExceptionStatementとは? わかりやすく解説

CodeThrowExceptionStatement クラス

例外スローするステートメント表します

名前空間: System.CodeDom
アセンブリ: System (system.dll 内)
構文構文

<SerializableAttribute> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class CodeThrowExceptionStatement
    Inherits CodeStatement
Dim instance As CodeThrowExceptionStatement
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
[ComVisibleAttribute(true)] 
public class CodeThrowExceptionStatement :
 CodeStatement
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
[ComVisibleAttribute(true)] 
public ref class CodeThrowExceptionStatement
 : public CodeStatement
/** @attribute SerializableAttribute() */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class CodeThrowExceptionStatement extends
 CodeStatement
SerializableAttribute 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class CodeThrowExceptionStatement extends
 CodeStatement
解説解説

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

ToThrow プロパティは、スローする例外指定します

使用例使用例

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.Object
   System.CodeDom.CodeObject
     System.CodeDom.CodeStatement
      System.CodeDom.CodeThrowExceptionStatement
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

CodeThrowExceptionStatement コンストラクタ ()


CodeThrowExceptionStatement コンストラクタ (CodeExpression)

例外型のインスタンス指定して、CodeThrowExceptionStatement クラス新しインスタンス初期化します。

名前空間: System.CodeDom
アセンブリ: System (system.dll 内)
構文構文

Public Sub New ( _
    toThrow As CodeExpression _
)
Dim toThrow As CodeExpression

Dim instance As New CodeThrowExceptionStatement(toThrow)
public CodeThrowExceptionStatement (
    CodeExpression toThrow
)
public:
CodeThrowExceptionStatement (
    CodeExpression^ toThrow
)
public CodeThrowExceptionStatement (
    CodeExpression toThrow
)
public function CodeThrowExceptionStatement
 (
    toThrow : CodeExpression
)

パラメータ

toThrow

スローする例外を示す CodeExpression。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CodeThrowExceptionStatement クラス
CodeThrowExceptionStatement メンバ
System.CodeDom 名前空間
CodeExpression クラス

CodeThrowExceptionStatement コンストラクタ

CodeThrowExceptionStatement クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

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

関連項目

CodeThrowExceptionStatement クラス
CodeThrowExceptionStatement メンバ
System.CodeDom 名前空間

CodeThrowExceptionStatement プロパティ


パブリック プロパティパブリック プロパティ

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

関連項目

CodeThrowExceptionStatement クラス
System.CodeDom 名前空間

CodeThrowExceptionStatement メソッド


CodeThrowExceptionStatement メンバ

例外スローするステートメント表します

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


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド CodeThrowExceptionStatement オーバーロードされます。 CodeThrowExceptionStatement クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ EndDirectives  終了ディレクティブを含む CodeDirectiveCollection オブジェクト取得します。(CodeStatement から継承されます。)
パブリック プロパティ LinePragma  コード ステートメントのある行を取得または設定します。 (CodeStatement から継承されます。)
パブリック プロパティ StartDirectives  開始ディレクティブを含む CodeDirectiveCollection オブジェクト取得します。(CodeStatement から継承されます。)
パブリック プロパティ ToThrow スローする例外取得または設定します
パブリック プロパティ UserData  現在のオブジェクトユーザー定義可能なデータ取得または設定します。(CodeObject から継承されます。)
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

CodeThrowExceptionStatement クラス
System.CodeDom 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「CodeThrowExceptionStatement」の関連用語

CodeThrowExceptionStatementのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



CodeThrowExceptionStatementのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS