Show / Hide Table of Contents

Interface IEntityCollection

Template for a collection of Entity.

Inherited Members
ICollection<IEntity>.Add(IEntity)
ICollection<IEntity>.Clear()
ICollection<IEntity>.Contains(IEntity)
ICollection<IEntity>.CopyTo(IEntity[], int)
ICollection<IEntity>.Remove(IEntity)
ICollection<IEntity>.Count
ICollection<IEntity>.IsReadOnly
IEnumerable<IEntity>.GetEnumerator()
ICloneable<IEntityCollection>.Clone()
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 name is null.

KeyNotFoundException

Thrown if no entity with the name name could be found.

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

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

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

true is the entity was removed succesfully; otherwise false.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

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

True if the entity is found; otherwise false.

Extension Methods

Utility.ThrowIfNull<T>(T, string)
Helpers.IsValid(IEntityCollection)
Helpers.Validate(IEntityCollection)
Helpers.Validate(IEntityCollection, IRules)
Utility.ThrowIfEmpty<T>(IEnumerable<T>, string)

See Also

IEnumerable<T>
ICollection<T>
In this article
Back to top Generated by DocFX