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

CodeAttachEventStatement クラス

イベント ハンドラデリゲートイベント結び付けるステートメント表します

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

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

CodeAttachEventStatement使用してイベント ハンドライベント結び付ける方法を示すコード例次に示します

' Defines a delegate creation expression that creates an EventHandler
 delegate pointing to TestMethod.
Dim createDelegate1 As New
 CodeDelegateCreateExpression(New CodeTypeReference("System.EventHandler"),
 New CodeThisReferenceExpression(), "TestMethod")

' Attaches an EventHandler delegate pointing to TestMethod to the TestEvent
 event.
Dim attachStatement1 As New
 CodeAttachEventStatement(New CodeThisReferenceExpression(),
 "TestEvent", createDelegate1)

' A Visual Basic code generator produces the following source code for
 the preceeding example code:

'     AddHandler TestEvent, AddressOf Me.TestMethod
// Defines a delegate creation expression that creates an EventHandler
 delegate pointing to a method named TestMethod.
CodeDelegateCreateExpression createDelegate1 = new CodeDelegateCreateExpression(
 
new CodeTypeReference( "System.EventHandler" ), new
 CodeThisReferenceExpression(), "TestMethod" );                      
          
// Attaches an EventHandler delegate pointing to TestMethod to the TestEvent
 event.
CodeAttachEventStatement attachStatement1 = new CodeAttachEventStatement(
 new CodeThisReferenceExpression(), "TestEvent", createDelegate1
 );

// A C# code generator produces the following source code for the preceeding
 example code:

//     this.TestEvent += new System.EventHandler(this.TestMethod);
// Defines a delegate creation expression that creates an EventHandler
 delegate pointing to a method named TestMethod.
CodeDelegateCreateExpression^ createDelegate1 = gcnew CodeDelegateCreateExpression(
 gcnew CodeTypeReference( "System.EventHandler" ),gcnew CodeThisReferenceExpression,"TestMethod"
 );

// Attaches an EventHandler delegate pointing to TestMethod to the TestEvent
 event.
CodeAttachEventStatement^ attachStatement1 = gcnew CodeAttachEventStatement( gcnew
 CodeThisReferenceExpression,"TestEvent",createDelegate1 );

// A C# code generator produces the following source code for the preceeding
 example code:
//     this.TestEvent += new System.EventHandler(this.TestMethod);
// Defines a delegate creation expression that creates an EventHandler
// delegate pointing to a method named TestMethod.
CodeDelegateCreateExpression createDelegate1 = new 
    CodeDelegateCreateExpression(new CodeTypeReference
    ("System.EventHandler"), new CodeThisReferenceExpression()
,
    "TestMethod");
// Attaches an EventHandler delegate pointing to TestMethod to the
// TestEvent event.
CodeAttachEventStatement attachStatement1 = new 
    CodeAttachEventStatement(new CodeThisReferenceExpression()
,
    "TestEvent", createDelegate1);
// A VJ# code generator produces the following source code for the 
// preceeding example code:
// this.add_TestEvent(new System.EventHandler(this.TestMethod));
継承階層継承階層
System.Object
   System.CodeDom.CodeObject
     System.CodeDom.CodeStatement
      System.CodeDom.CodeAttachEventStatement
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

CodeAttachEventStatement コンストラクタ ()


CodeAttachEventStatement コンストラクタ (CodeEventReferenceExpression, CodeExpression)

イベントデリゲート指定して、CodeAttachEventStatement クラス新しインスタンス初期化します。

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

Public Sub New ( _
    eventRef As CodeEventReferenceExpression, _
    listener As CodeExpression _
)
Dim eventRef As CodeEventReferenceExpression
Dim listener As CodeExpression

Dim instance As New CodeAttachEventStatement(eventRef,
 listener)
public CodeAttachEventStatement (
    CodeEventReferenceExpression eventRef,
    CodeExpression listener
)
public:
CodeAttachEventStatement (
    CodeEventReferenceExpression^ eventRef, 
    CodeExpression^ listener
)
public CodeAttachEventStatement (
    CodeEventReferenceExpression eventRef, 
    CodeExpression listener
)
public function CodeAttachEventStatement (
    eventRef : CodeEventReferenceExpression, 
    listener : CodeExpression
)

パラメータ

eventRef

イベント ハンドラ結び付けるイベントを示す CodeEventReferenceExpression。

listener

新しイベント ハンドラを示す CodeExpression。

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

CodeAttachEventStatement コンストラクタ (CodeExpression, String, CodeExpression)

イベントイベント名、およびイベント ハンドラ デリゲート格納しているオブジェクト指定して、CodeAttachEventStatement クラス新しインスタンス初期化します。

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

Public Sub New ( _
    targetObject As CodeExpression, _
    eventName As String, _
    listener As CodeExpression _
)
Dim targetObject As CodeExpression
Dim eventName As String
Dim listener As CodeExpression

Dim instance As New CodeAttachEventStatement(targetObject,
 eventName, listener)
public CodeAttachEventStatement (
    CodeExpression targetObject,
    string eventName,
    CodeExpression listener
)
public:
CodeAttachEventStatement (
    CodeExpression^ targetObject, 
    String^ eventName, 
    CodeExpression^ listener
)
public CodeAttachEventStatement (
    CodeExpression targetObject, 
    String eventName, 
    CodeExpression listener
)
public function CodeAttachEventStatement (
    targetObject : CodeExpression, 
    eventName : String, 
    listener : CodeExpression
)

パラメータ

targetObject

イベント格納するオブジェクトを示す CodeExpression。

eventName

イベント ハンドラ結び付けるイベントの名前。

listener

新しイベント ハンドラを示す CodeExpression

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

CodeAttachEventStatement コンストラクタ

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

名前 説明
CodeAttachEventStatement () CodeAttachEventStatement クラス新しインスタンス初期化します。
CodeAttachEventStatement (CodeEventReferenceExpression, CodeExpression) イベントデリゲート指定してCodeAttachEventStatement クラス新しインスタンス初期化します。
CodeAttachEventStatement (CodeExpression, String, CodeExpression) イベントイベント名、およびイベント ハンドラ デリゲート格納しているオブジェクト指定してCodeAttachEventStatement クラス新しインスタンス初期化します。
参照参照

関連項目

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

CodeAttachEventStatement プロパティ


CodeAttachEventStatement メソッド


CodeAttachEventStatement メンバ

イベント ハンドラデリゲートイベント結び付けるステートメント表します

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


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド CodeAttachEventStatement オーバーロードされます。 CodeAttachEventStatement クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

CodeAttachEventStatement クラス
System.CodeDom 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からCodeAttachEventStatementを検索した結果を表示しています。
Weblioに収録されているすべての辞書からCodeAttachEventStatementを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からCodeAttachEventStatement を検索

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

辞書ショートカット

すべての辞書の索引

「CodeAttachEventStatement」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS