CodeEventReferenceExpression CodeEventReferenceExpression CodeEventReferenceExpression CodeEventReferenceExpression Class

定義

代表事件的參考。Represents a reference to an event.

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

範例

下列範例示範CodeEventReferenceExpression如何使用來參考名為 TestEvent 的事件。The following example demonstrates use of CodeEventReferenceExpression to reference an event named 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可以用來代表事件的參考。CodeEventReferenceExpression can be used to represent a reference to an event.

TargetObject屬性會指定包含事件的物件。The TargetObject property specifies the object that contains the event. EventName屬性會指定事件的名稱。The EventName property specifies the name of the event.

建構函式

CodeEventReferenceExpression() CodeEventReferenceExpression() CodeEventReferenceExpression() CodeEventReferenceExpression()

初始化 CodeEventReferenceExpression 類別的新執行個體。Initializes a new instance of the CodeEventReferenceExpression class.

CodeEventReferenceExpression(CodeExpression, String) CodeEventReferenceExpression(CodeExpression, String) CodeEventReferenceExpression(CodeExpression, String) CodeEventReferenceExpression(CodeExpression, String)

使用指定的目標物件和事件名稱,來初始化 CodeEventReferenceExpression 類別的新執行個體。Initializes a new instance of the CodeEventReferenceExpression class using the specified target object and event name.

屬性

EventName EventName EventName EventName

取得或設定事件的名稱。Gets or sets the name of the event.

TargetObject TargetObject TargetObject TargetObject

取得或設定包含事件的物件。Gets or sets the object that contains the event.

UserData UserData UserData UserData

取得目前物件的使用者可定義資料。Gets the user-definable data for the current object.

(Inherited from CodeObject)

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於