Show / Hide Table of Contents

Class Event<TArg0, TArg1>

A dual argument event.

Inheritance
System.Object
EventBase
Event<TArg0, TArg1>
Namespace: FasterGames.Whiskey.Events
Assembly: cs.temp.dll.dll
Syntax
public abstract class Event<TArg0, TArg1> : EventBase
Type Parameters
Name Description
TArg0

Argument type 1

TArg1

Argument type 2

Fields

Listeners

Storage for the bound listeners.

Declaration
protected readonly List<Action<TArg0, TArg1>> Listeners
Field Value
Type Description
System.Collections.Generic.List<Action<TArg0, TArg1>>

Properties

EventTypes

The argument types of the event.

Declaration
public override List<Type> EventTypes { get; }
Property Value
Type Description
System.Collections.Generic.List<Type>
Overrides
EventBase.EventTypes

ListenerCount

The number of currently listening listeners.

Declaration
public override int ListenerCount { get; }
Property Value
Type Description
System.Int32
Overrides
EventBase.ListenerCount

Methods

AddListener(Action<TArg0, TArg1>)

Add a listener to be invoked when the event is raised with Raise(TArg0, TArg1).

Declaration
public void AddListener(Action<TArg0, TArg1> listener)
Parameters
Type Name Description
Action<TArg0, TArg1> listener

listener

Raise(TArg0, TArg1)

Raise the event, invoking all listeners.

Declaration
public void Raise(TArg0 arg0, TArg1 arg1)
Parameters
Type Name Description
TArg0 arg0

first argument

TArg1 arg1

second argument

Raise(Box<TArg0>, Box<TArg1>)

Raise the event with a box, invoking all listeners.

Declaration
public void Raise(Box<TArg0> arg0, Box<TArg1> arg1)
Parameters
Type Name Description
Box<TArg0> arg0

first argument, boxed

Box<TArg1> arg1

second argument, boxed

Remarks

The value inside the box will be used to raise the event.

RemoveListener(Action<TArg0, TArg1>)

Remove a listener, so it will no longer be invoked when the event is raised with Raise(TArg0, TArg1)

Declaration
public void RemoveListener(Action<TArg0, TArg1> listener)
Parameters
Type Name Description
Action<TArg0, TArg1> listener

listener

UnsafeRaise(Object[])

An unsafe (can fail at runtime) hook to raise events. Do not use.

Declaration
public override void UnsafeRaise(params object[] args)
Parameters
Type Name Description
System.Object[] args

event arguments

Overrides
EventBase.UnsafeRaise(Object[])
Remarks

This exists to expose a hook for generic code (e.g. editors) that may want to invoke events knowing only the base type.

In This Article
Back to top Copyright FasterGames ©