CodeEventReferenceExpression 類別

定義

代表事件的參考。

public ref class CodeEventReferenceExpression : System::CodeDom::CodeExpression
public class CodeEventReferenceExpression : System.CodeDom.CodeExpression
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeEventReferenceExpression : System.CodeDom.CodeExpression
type CodeEventReferenceExpression = class
    inherit CodeExpression
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeEventReferenceExpression = class
    inherit CodeExpression
Public Class CodeEventReferenceExpression
Inherits CodeExpression
繼承
CodeEventReferenceExpression
屬性

範例

下列範例示範如何使用 CodeEventReferenceExpression 來參考名為TestEvent的事件。

// Represents a reference to an event.
CodeEventReferenceExpression^ eventRef1 = gcnew CodeEventReferenceExpression( gcnew CodeThisReferenceExpression,"TestEvent" );

// A C# code generator produces the following source code for the preceeding example code:
//        this.TestEvent
// Represents a reference to an event.
CodeEventReferenceExpression eventRef1 = new CodeEventReferenceExpression( new CodeThisReferenceExpression(), "TestEvent" );

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

//        this.TestEvent
' Represents a reference to an event.
Dim eventRef1 As New CodeEventReferenceExpression(New CodeThisReferenceExpression(), "TestEvent")

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

'       Me.TestEvent

備註

CodeEventReferenceExpression 可用來表示事件的參考。

屬性 TargetObject 會指定包含 事件的物件。 屬性 EventName 會指定事件的名稱。

建構函式

CodeEventReferenceExpression()

初始化 CodeEventReferenceExpression 類別的新執行個體。

CodeEventReferenceExpression(CodeExpression, String)

使用指定的目標物件和事件名稱,來初始化 CodeEventReferenceExpression 類別的新執行個體。

屬性

EventName

取得或設定事件的名稱。

TargetObject

取得或設定包含事件的物件。

UserData

取得目前物件的使用者可定義資料。

(繼承來源 CodeObject)

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於