TypeBuilder.DefineEvent Method (String, EventAttributes, Type)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

public EventBuilder DefineEvent(
	string name,
	EventAttributes attributes,
	Type eventtype
)

Parameters

name
Type: System.String

The name of the event. name cannot contain embedded nulls.

attributes
Type: System.Reflection.EventAttributes

The attributes of the event.

eventtype
Type: System.Type

The type of the event.

Return Value

Type: System.Reflection.Emit.EventBuilder

The defined event.

Exception Condition
ArgumentException

The length of name is zero.

ArgumentNullException

name is null.

-or-

eventtype is null.

InvalidOperationException

The type was previously created using CreateType.

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Return to top
Show: