Skip to main content

OneTimeEvent<T>

A class in Root.Township, the global namespace.

Event that fires once. Handlers added after it fired run straight away with the same arguments.

Constructors​

MemberWhat it is
OneTimeEvent(bool isBlockingDuplicateCall = true)Creates an OneTimeEvent from isBlockingDuplicateCall.

Fields​

2 private and internal fields
MemberWhat it is
private object[] argsArguments from the invoke, replayed to late handlers.
private static readonly Logger loggerShared AltaEvent logger.

Properties​

MemberWhat it is
bool IsBlockingDuplicateCall { get; }If on (the default), a second Invoke logs an error and does nothing.

Methods​

MemberWhat it is
override void Invoke(params object[] args)Fires the event and remembers the arguments; a second call is refused with an error when IsBlockingDuplicateCall is set.
static OneTimeEvent<T> op_Addition(OneTimeEvent<T> altaEvent, T eventHandler)Adds a handler, or calls it at once if the event already fired.
static OneTimeEvent<T> op_Subtraction(OneTimeEvent<T> altaEvent, T eventHandler)Removes a handler.

Used in​

Members of other types that take, return or hold a OneTimeEvent&lt;T>: