EntityComponentCollection Class
Namespace: Stride.EngineAssembly: 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| Name | Description | |
|---|---|---|
| Constructors | ||
| EntityComponentCollection() | ||
| Methods | ||
| ClearItems() | ||
| Get<T>() | Gets the first component of the specified type or derived type. | |
| Get<T>(Int32) | Gets the index'th component of the specified type or derived type. | |
| GetAll<T>() | Gets all the components of the specified type or derived type. | |
| InsertItem(Int32, EntityComponent) | ||
| Remove<T>() | Removes the first component of the specified type or derived type. | |
| RemoveAll<T>() | Removes all components of the specified type or derived type. | |
| RemoveItem(Int32) | ||
| SetItem(Int32, EntityComponent) | ||
Constructors
EntityComponentCollection()
public EntityComponentCollection()Methods
ClearItems()
protected override void ClearItems()Overrides
Get<T>()
Gets the first component of the specified type or derived type.
public T Get<T>()
    where T : EntityComponentReturns
| Type | Description | 
|---|---|
| T | The first component or null if it was not found | 
Type Parameters
| Name | Description | 
|---|---|
| T | Type of the component | 
Get<T>(Int32)
Gets the index'th component of the specified type or derived type.
public T Get<T>(int index)
    where T : EntityComponentParameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | index | Index of the component of the same type | 
Returns
| Type | Description | 
|---|---|
| T | The component or null if it was not found | 
Type Parameters
| Name | Description | 
|---|---|
| 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.
GetAll<T>()
Gets all the components of the specified type or derived type.
public IEnumerable<T> GetAll<T>()
    where T : EntityComponentReturns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerable<T> | An iterator on the component matching the specified type | 
Type Parameters
| Name | Description | 
|---|---|
| T | Type of the component | 
InsertItem(Int32, EntityComponent)
protected override void InsertItem(int index, EntityComponent item)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | index | |
| EntityComponent | item | 
Overrides
Remove<T>()
Removes the first component of the specified type or derived type.
public void Remove<T>()
    where T : EntityComponentType Parameters
| Name | Description | 
|---|---|
| T | Type of the component | 
RemoveAll<T>()
Removes all components of the specified type or derived type.
public void RemoveAll<T>()
    where T : EntityComponentType Parameters
| Name | Description | 
|---|---|
| T | Type of the component | 
RemoveItem(Int32)
protected override void RemoveItem(int index)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | index | 
Overrides
SetItem(Int32, EntityComponent)
protected override void SetItem(int index, EntityComponent item)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | index | |
| EntityComponent | item |