Edit

Share via


CodeEventReferenceExpression Class

Definition

Represents a reference to an event.

C#
public class CodeEventReferenceExpression : System.CodeDom.CodeExpression
C#
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeEventReferenceExpression : System.CodeDom.CodeExpression
Inheritance
CodeEventReferenceExpression
Attributes

Examples

The following example demonstrates use of CodeEventReferenceExpression to reference an event named TestEvent.

C#
// 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

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

Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9