CodeEventReferenceExpression 类

定义

表示对事件的引用。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
继承
CodeEventReferenceExpression
属性

示例

下面的示例演示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 类的新实例。Initializes a new instance of the CodeEventReferenceExpression class.

CodeEventReferenceExpression(CodeExpression, String)

使用指定的目标对象和事件名初始化 CodeEventReferenceExpression 类的新实例。Initializes a new instance of the CodeEventReferenceExpression class using the specified target object and event name.

属性

EventName

获取或设置事件名。Gets or sets the name of the event.

TargetObject

获取或设置包含事件的对象。Gets or sets the object that contains the event.

UserData

获取当前对象的用户可定义数据。Gets the user-definable data for the current object.

(继承自 CodeObject)

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于