Table of Contents

Class EntityComponentCollection

Namespace
Stride.Engine
Assembly
Stride.Engine.dll

A collection of EntityComponent managed exclusively by the Entity.

[DataContract("EntityComponentCollection")]
public sealed class EntityComponentCollection : FastCollection<EntityComponent>, IList<EntityComponent>, ICollection<EntityComponent>, IReadOnlyList<EntityComponent>, IReadOnlyCollection<EntityComponent>, IEnumerable<EntityComponent>, IEnumerable
Inheritance
EntityComponentCollection
Implements
Inherited Members
Extension Methods

Constructors

EntityComponentCollection()

public EntityComponentCollection()

Methods

ClearItems()

protected override void ClearItems()

GetAll<T>()

Gets all the components of the specified type or derived type.

public IEnumerable<T> GetAll<T>() where T : EntityComponent

Returns

IEnumerable<T>

An iterator on the component matching the specified type

Type Parameters

T

Type of the component

Get<T>()

Gets the first component of the specified type or derived type.

public T Get<T>() where T : EntityComponent

Returns

T

The first component or null if it was not found

Type Parameters

T

Type of the component

Get<T>(int)

Gets the index'th component of the specified type or derived type.

public T Get<T>(int index) where T : EntityComponent

Parameters

index int

Index of the component of the same type

Returns

T

The component or null if it was not found

Type Parameters

T

Type of the component

Remarks

  • If index > 0, it will take the index'th component of the specified T.
  • An index == 0 is equivalent to calling Get<T>()
  • if index < 0, it will start from the end of the list to the beginning. A value of -1 means the first last component.

InsertItem(int, EntityComponent)

protected override void InsertItem(int index, EntityComponent item)

Parameters

index int
item EntityComponent

RemoveAll<T>()

Removes all components of the specified type or derived type.

public void RemoveAll<T>() where T : EntityComponent

Type Parameters

T

Type of the component

RemoveItem(int)

protected override void RemoveItem(int index)

Parameters

index int

Remove<T>()

Removes the first component of the specified type or derived type.

public void Remove<T>() where T : EntityComponent

Type Parameters

T

Type of the component

SetItem(int, EntityComponent)

protected override void SetItem(int index, EntityComponent item)

Parameters

index int
item EntityComponent