Table of Contents

Class GameEvent<TArgs>

Namespace
SkyrimForge.Events
Assembly
SkyrimForge.dll

An IGameEvent<TArgs> with a Raise(TArgs) method for the code that raises the event.

public sealed class GameEvent<TArgs> : IGameEvent<TArgs> where TArgs : struct

Type Parameters

TArgs
Inheritance
GameEvent<TArgs>
Implements
IGameEvent<TArgs>
Inherited Members
Extension Methods

Constructors

GameEvent(Action<Exception>)

Creates an event with no subscribers.

public GameEvent(Action<Exception> reportFailure)

Parameters

reportFailure Action<Exception>

Receives the exception from a subscriber that threw. That subscriber is dropped first, so it is reported once.

Exceptions

ArgumentNullException

reportFailure is null.

Methods

Raise(TArgs)

Invokes every current subscriber. A subscriber that throws is removed and reported, and the subscribers after it still run.

public void Raise(TArgs args)

Parameters

args TArgs

Subscribe(AsyncGameEventHandler<TArgs>)

Registers handler, whose task the event does not await.

public ISubscription Subscribe(AsyncGameEventHandler<TArgs> handler)

Parameters

handler AsyncGameEventHandler<TArgs>

Returns

ISubscription

Remarks

A later raise can call the handler again while an earlier task is pending. A handler that throws, or whose task faults, is dropped and not called again, even after a later load. The exception is written to its plugin's log. A canceled task does not drop the handler.

Exceptions

ArgumentNullException

handler is null.

Subscribe(GameEventHandler<TArgs>)

Registers handler.

public ISubscription Subscribe(GameEventHandler<TArgs> handler)

Parameters

handler GameEventHandler<TArgs>

Returns

ISubscription

Remarks

A handler that throws is dropped and not called again, even after a later load. The exception is written to its plugin's log.

Exceptions

ArgumentNullException

handler is null.