Modifica

Condividi tramite


CodeEventReferenceExpression Class

Definition

Represents a reference to an event.

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
Inheritance
CodeEventReferenceExpression
Attributes

Examples

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

Remarks

CodeEventReferenceExpression can be used to represent a reference to an event.

The TargetObject property specifies the object that contains the event. The EventName property specifies the name of the event.

Constructors

CodeEventReferenceExpression()

Initializes a new instance of the CodeEventReferenceExpression class.

CodeEventReferenceExpression(CodeExpression, String)

Initializes a new instance of the CodeEventReferenceExpression class using the specified target object and event name.

Properties

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.

(Inherited from CodeObject)

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to