This documentation is archived and is not being maintained.

TypeBuilder.DefineEvent Method

Adds a new event to the class, with the given name, attributes and event type.

[Visual Basic]
Public Function DefineEvent( _
   ByVal name As String, _
   ByVal attributes As EventAttributes, _
   ByVal eventtype As Type _
) As EventBuilder
[C#]
public EventBuilder DefineEvent(
 string name,
 EventAttributes attributes,
 Type eventtype
);
[C++]
public: EventBuilder* DefineEvent(
 String* name,
 EventAttributes attributes,
 Type* eventtype
);
[JScript]
public function DefineEvent(
   name : String,
 attributes : EventAttributes,
 eventtype : Type
) : EventBuilder;

Parameters

name
The name of the event. name cannot contain embedded nulls.
attributes
The attributes of the event.
eventtype
The type of the event.

Return Value

The defined event.

Exceptions

Exception Type Condition
ArgumentException The length of name is zero.
ArgumentNullException name is a null reference (Nothing in Visual Basic).

-or-

eventtype is a null reference (Nothing).

InvalidOperationException The type was previously created using CreateType

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

TypeBuilder Class | TypeBuilder Members | System.Reflection.Emit Namespace

Show: