Interface IEntityCollection
Template for a collection of Entity.
Inherited Members
Namespace: SpiceSharp.Entities
Assembly: SpiceSharp.dll
Syntax
public interface IEntityCollection : ICollection<IEntity>, IEnumerable<IEntity>, IEnumerable, ICloneable<IEntityCollection>
Properties
Comparer
Gets the comparer used to compare Entity names.
Declaration
IEqualityComparer<string> Comparer { get; }
Property Value
| Type | Description |
|---|---|
| IEqualityComparer<string> | The comparer. |
this[string]
Gets the IEntity with the specified name.
Declaration
IEntity this[string name] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the entity. |
Property Value
| Type | Description |
|---|---|
| IEntity | The IEntity. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
| KeyNotFoundException | Thrown if no entity with the name |
Methods
ByType<E>()
Gets all entities that are of a specified type.
Declaration
IEnumerable<E> ByType<E>() where E : IEntity
Returns
| Type | Description |
|---|---|
| IEnumerable<E> | The entities. |
Type Parameters
| Name | Description |
|---|---|
| E | The type of entity. |
Contains(string)
Determines whether this instance contains an IEntity with the specified name.
Declaration
bool Contains(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name. |
Returns
| Type | Description |
|---|---|
| bool |
|
Remove(string)
Removes the IEntity with specified name.
Declaration
bool Remove(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the entity. |
Returns
| Type | Description |
|---|---|
| bool |
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
TryGetEntity(string, out IEntity)
Tries to find an Entity in the collection.
Declaration
bool TryGetEntity(string name, out IEntity entity)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the entity. |
| IEntity | entity | The entity. |
Returns
| Type | Description |
|---|---|
| bool |
|
Extension Methods
See Also
IEnumerable<T>
ICollection<T>