次の方法で共有


TypeBuilder.DefineEvent Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Function DefineEvent ( _
    name As String, _
    attributes As EventAttributes, _
    eventtype As Type _
) As EventBuilder
[SecuritySafeCriticalAttribute]
public EventBuilder DefineEvent(
    string name,
    EventAttributes attributes,
    Type eventtype
)

Parameters

  • name
    Type: System.String
    The name of the event. name cannot contain embedded nulls.

Return Value

Type: System.Reflection.Emit.EventBuilder
The defined event.

Exceptions

Exception Condition
ArgumentException

The length of name is zero.

ArgumentNullException

name is nulla null reference (Nothing in Visual Basic).

-or-

eventtype is nulla null reference (Nothing in Visual Basic).

InvalidOperationException

The type was previously created using CreateType.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.