InsertBehavior(IStunt, Int32) Method

Definition

Namespace Stunts
Assembly Stunts.dll

Inserts a behavior of the given type into the stunt behavior pipeline at the specified index, creating a new instance per pipeline seeding.

public static IStunt InsertBehavior<TBehavior>(this IStunt stunt, int index)
    where TBehavior : IStuntBehavior, new()

Type parameters

TBehavior
The behavior type. Must have a public parameterless constructor.

Parameters

stunt
IStunt

The stunt to insert the behavior into.

index
Int32

The index to insert the behavior at.

Returns

IStunt
The stunt, for chaining.

Remarks

Equivalent to InsertBehavior(index, () => new TBehavior()): if the stunt is not constructed yet, a new instance is created per pipeline seeding (e.g. per StuntBuilder.Build call); if it is already constructed, the instance is created immediately and inserted into the live pipeline.