CodeEventReferenceExpression 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示对事件的引用。
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 名为 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) |