Show / Hide Table of Contents

Interface IBehaviorContainerCollection

An interface that describes a collection of IBehaviorContainer instances.

Inherited Members
IEnumerable<IBehaviorContainer>.GetEnumerator()
Namespace: SpiceSharp.Behaviors
Assembly: SpiceSharp.dll
Syntax
public interface IBehaviorContainerCollection : IEnumerable<IBehaviorContainer>, IEnumerable

Properties

Comparer

Gets the comparer used to identify elements.

Declaration
IEqualityComparer<string> Comparer { get; }
Property Value
Type Description
IEqualityComparer<string>

The comparer.

Count

Gets the number of behavior containers in the collection.

Declaration
int Count { get; }
Property Value
Type Description
int

The number of behavior containers.

this[string]

Gets the IBehaviorContainer with the specified name.

Declaration
IBehaviorContainer this[string name] { get; }
Parameters
Type Name Description
string name

The name.

Property Value
Type Description
IBehaviorContainer

The IBehaviorContainer.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

BehaviorsNotFoundException

Thrown if the behavior container of the specified name could not be found.

Keys

Gets the behavior container names.

Declaration
IEnumerable<string> Keys { get; }
Property Value
Type Description
IEnumerable<string>

An IEnumerable<T> object that contains the name of each BehaviorContainer.

Methods

Add(IBehaviorContainer)

Adds the IBehaviorContainer with the specified name.

Declaration
void Add(IBehaviorContainer container)
Parameters
Type Name Description
IBehaviorContainer container

The behavior container.

Exceptions
Type Condition
ArgumentNullException

Thrown if container if null.

ArgumentException

Thrown if a behavior container already exists with the same name.

Clear()

Clears all containers in the collection.

Declaration
void Clear()

Contains(string)

Determines whether this instance contains a container by the specified name.

Declaration
bool Contains(string name)
Parameters
Type Name Description
string name

The name.

Returns
Type Description
bool

true if the collection contains the container; otherwise, false.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

GetBehaviorList<B>()

Gets a list of behaviors of a specific behavior type.

Declaration
BehaviorList<B> GetBehaviorList<B>() where B : IBehavior
Returns
Type Description
BehaviorList<B>

A BehaviorList<T> with all behaviors of the specified type.

Type Parameters
Name Description
B

The IBehavior type.

TryGetBehaviors(string, out IBehaviorContainer)

Tries to get the behavior container associated with the specified name.

Declaration
bool TryGetBehaviors(string name, out IBehaviorContainer container)
Parameters
Type Name Description
string name

The name.

IBehaviorContainer container

The container.

Returns
Type Description
bool

true if the behavior was found; otherwise false.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

Events

BehaviorsNotFound

Occurs when a behavior has not been found.

Declaration
event EventHandler<BehaviorsNotFoundEventArgs> BehaviorsNotFound
Event Type
Type Description
EventHandler<BehaviorsNotFoundEventArgs>

Extension Methods

Utility.ThrowIfNull<T>(T, string)
Utility.ThrowIfEmpty<T>(IEnumerable<T>, string)
In this article
Back to top Generated by DocFX