Clears all handlers from the event
Gets the amount of handlers that are bound to this event
Call all event handlers bound to this event
Call all event handlers bound to this event
Add a new handler
Add a new handler
Deletes a handler
Test the creation and execution of an event
struct TestEventData { string name; } bool wasRun; // Test creation auto eventHandler = (void* sender, TestEventData args) { assert(args.name == "test", "Expected value of event args to be \"Test\""); wasRun = true; }; Event!TestEventData testEvent = new Event!TestEventData; testEvent ~= eventHandler; // Test execution testEvent(null, TestEventData("test")); assert(wasRun, "Expected event to be executed!"); // Test deletion of event handler testEvent -= eventHandler; assert(testEvent.count == 0, "Expected event to have no handlers!");
An event. To add event handlers to the event use ~= or += followed by your event delegate. (use EventHandler for an easy signature for the delegate)
The delegate should take an void* sender and EventArgs argument.
Use -= to remove an event handler delegate from the event.