Share via


Event.merge<'Del1,'T,'Del2> Function (F#)

Fires the output event when either of the input events fire.

Namespace/Module Path: Microsoft.FSharp.Control.Event

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

// Signature:
Event.merge : IEvent<'Del1,'T> -> IEvent<'Del2,'T> -> IEvent<'T> (requires delegate and delegate)

// Usage:
Event.merge event1 event2

Parameters

  • event1
    Type: IEvent<'Del1,'T>

    The first input event.

  • event2
    Type: IEvent<'Del2,'T>

    The second input event.

Return Value

An event that fires when either of the input events fire.

Remarks

This function is named Merge in compiled assemblies. If you are accessing the function from a language other than F#, or through reflection, use this name.

Example

The following code example shows how to use the Event.merge function.

let form = new Form(Text = "F# Windows Form",
                    Visible = true,
                    TopMost = true)
form.MouseClick
    |> Event.merge(form.MouseDoubleClick)
    |> Event.add ( fun evArgs ->
        form.BackColor <- System.Drawing.Color.FromArgb(
            evArgs.X, evArgs.Y, evArgs.X ^^^ evArgs.Y) )

Platforms

Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2

Version Information

F# Core Library Versions

Supported in: 2.0, 4.0, Portable

See Also

Reference

Control.Event Module (F#)

Microsoft.FSharp.Control Namespace (F#)