AddBehavior(IStunt) Method

Definition

Namespace Stunts
Assembly Stunts.dll

Adds a behavior of the given type to a stunt, creating a new instance per pipeline seeding.

public static IStunt AddBehavior<TBehavior>(this IStunt stunt)
    where TBehavior : IStuntBehavior, new()

Type parameters

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

Parameters

stunt
IStunt

The stunt to add the behavior to.

Returns

IStunt
The stunt, for chaining.

Remarks

Equivalent to AddBehavior(() => 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 added to the live pipeline.