Share via


RuntimeHelpers.CreateEvent<'Delegate,'Args> Function (F#)

Creates an anonymous event with the given handlers.

Namespace/Module Path: Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers

Assembly: FSharp.Core (in FSharp.Core.dll)

// Signature:
RuntimeHelpers.CreateEvent : ('Delegate -> unit) -> ('Delegate -> unit) -> ((obj -> 'Args -> unit) -> 'Delegate) -> IEvent<'Delegate,'Args> (requires delegate)

// Usage:
RuntimeHelpers.CreateEvent addHandler removeHandler createHandler

Parameters

  • addHandler
    Type: 'Delegate -> unit

    A function to handle adding a delegate for the event to trigger.

  • removeHandler
    Type: 'Delegate -> unit

    A function to handle removing a delegate that the event triggers.

  • createHandler
    Type: (obj -> 'Args -> unit) -> 'Delegate

    A function to produce the delegate type the event can trigger.

Return Value

The initialized event as an object that implements IEvent.

Platforms

Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2

Version Information

F# Runtime

Supported in: 2.0, 4.0

Silverlight

Supported in: 3

See Also

Reference

CompilerServices.RuntimeHelpers Module (F#)

Microsoft.FSharp.Core.CompilerServices Namespace (F#)