Class BehaviorContainer.BehaviorContainerBuilder<TContext>
Default implementation of the IBehaviorContainerBuilder<TContext>.
Implements
IBehaviorContainerBuilder<TContext>
Inherited Members
Namespace: SpiceSharp.Behaviors
Assembly: SpiceSharp.dll
Syntax
protected class BehaviorContainer.BehaviorContainerBuilder<TContext> : IBehaviorContainerBuilder<TContext> where TContext : IBindingContext
Type Parameters
| Name | Description |
|---|---|
| TContext | The type of binding context. |
Constructors
BehaviorContainerBuilder(IBehaviorContainer, ISimulation, TContext)
Initializes a new instance of the BehaviorContainer.BehaviorContainerBuilder<TContext> class.
Declaration
public BehaviorContainerBuilder(IBehaviorContainer container, ISimulation simulation, TContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| IBehaviorContainer | container | The container. |
| ISimulation | simulation | The simulation. |
| TContext | context | The context. |
Methods
AddIfNo<TBehavior>(Func<TContext, IBehavior>)
Adds a behavior if the specified behavior does not yet exist in the container.
Declaration
public IBehaviorContainerBuilder<TContext> AddIfNo<TBehavior>(Func<TContext, IBehavior> factory) where TBehavior : IBehavior
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TContext, IBehavior> | factory | The factory. |
Returns
| Type | Description |
|---|---|
| IBehaviorContainerBuilder<TContext> | The original container builder. This can be used for chaining. |
Type Parameters
| Name | Description |
|---|---|
| TBehavior | The target type of the behavior. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
Implements
Extension Methods
See Also
IBehaviorContainerBuilder<TContext>