InsertBehavior(TStunt, Int32, Func) Method

Definition

Namespace Stunts
Assembly Stunts.dll

Inserts a behavior factory into the stunt behavior pipeline at the specified index, so each pipeline seeded from these behaviors gets its own behavior instance instead of sharing one.

public static TStunt InsertBehavior<TStunt>(this TStunt stunt, int index, Func<IStuntBehavior> factory)
    where TStunt : IStunt

Type parameters

TStunt

Parameters

stunt
{TStunt}

The stunt to insert the behavior factory to.

index
Int32

The index to insert the behavior factory at.

factory
Func<IStuntBehavior>

Function invoked to create the behavior instance.

Returns

{TStunt}

Remarks

If the stunt is not constructed yet, the factory is registered and invoked once per pipeline seeding (e.g. per StuntBuilder.Build call). If the stunt is already constructed, the factory is invoked immediately and the resulting instance is inserted into the live pipeline.