Skip to content
Andrew edited this page Apr 7, 2015 · 2 revisions

Similar to C#, the += and -= operators are used to subscribe to events:

obj.Event += (s e) -> print "invoked"

To unsubscribe from an event later on, the exact same reference is needed. Therefore, it's best to save it into a local variable:

let handler : EventHandler = (s e) -> print "invoked"
obj.Event += handler
obj.DoSomeStuff ()
obj.Event -= handler

Clone this wiki locally