F # IEvent.create

Where did he go?

let triggerFindNext,findNextEvent = IEvent.create<EventArgs>()

The field, constructor, or 'create' element is not defined

Maybe I should add some structure for it?

+3
source share
1 answer

Function is IEvent.createdeprecated. A new way to create events is to instantiate the type Event. In the simplest case, you can write just this:

let evt = new Event<EventArgs>() 

// Trigger event (instead of first element of the tuple)
evt.Trigger()
// Returns IEvent<EventArgs> value (instead of second element of the tuple)
evt.Publish

This is an event that uses a value IEvent<_>(and does not generate a .NET compatible event if you expand it as a property), and uses a common delegate Handler<_>from the F # libraries.

( .NET , #, CLIEvent, Event, , , )

EDIT. F # ( ): http://fssnip.net/1d

+6

Source: https://habr.com/ru/post/1780835/


All Articles