Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    EntityComponentCollection Class

    Namespace: Stride.Engine
    Assembly: Stride.Engine.dll

    A collection of EntityComponent managed exclusively by the Entity.

    System.Object → FastCollection<EntityComponent> → EntityComponentCollection
    Derived from EntityComponentCollection:

    [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)
    | Improve this Doc View Source

    Constructors


    EntityComponentCollection()

    public EntityComponentCollection()
    | Improve this Doc View Source

    Methods


    ClearItems()

    protected override void ClearItems()
    Overrides
    Stride.Core.Collections.FastCollection<Stride.Engine.EntityComponent>.ClearItems()

    Get<T>()

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

    public T Get<T>()
        where T : EntityComponent
    Returns
    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 : EntityComponent
    Parameters
    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 : EntityComponent
    Returns
    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
    Stride.Core.Collections.FastCollection<Stride.Engine.EntityComponent>.InsertItem(System.Int32, Stride.Engine.EntityComponent)

    Remove<T>()

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

    public void Remove<T>()
        where T : EntityComponent
    Type 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 : EntityComponent
    Type Parameters
    Name Description
    T

    Type of the component


    RemoveItem(Int32)

    protected override void RemoveItem(int index)
    Parameters
    Type Name Description
    System.Int32 index
    Overrides
    Stride.Core.Collections.FastCollection<Stride.Engine.EntityComponent>.RemoveItem(System.Int32)

    SetItem(Int32, EntityComponent)

    protected override void SetItem(int index, EntityComponent item)
    Parameters
    Type Name Description
    System.Int32 index
    EntityComponent item
    Overrides
    Stride.Core.Collections.FastCollection<Stride.Engine.EntityComponent>.SetItem(System.Int32, Stride.Engine.EntityComponent)

    Inherited Members

    FastCollection<EntityComponent>.Capacity
    FastCollection<EntityComponent>.Count
    FastCollection<EntityComponent>.Item[Int32]
    FastCollection<EntityComponent>.Add(EntityComponent)
    FastCollection<EntityComponent>.Clear()
    FastCollection<EntityComponent>.Contains(EntityComponent)
    FastCollection<EntityComponent>.CopyTo(EntityComponent[], Int32)
    FastCollection<EntityComponent>.IndexOf(EntityComponent)
    FastCollection<EntityComponent>.Insert(Int32, EntityComponent)
    FastCollection<EntityComponent>.Remove(EntityComponent)
    FastCollection<EntityComponent>.RemoveAt(Int32)
    FastCollection<EntityComponent>.IEnumerable<EntityComponent>.GetEnumerator()
    FastCollection<EntityComponent>.IEnumerable.GetEnumerator()
    FastCollection<EntityComponent>.AddRange<TE>(TE)
    FastCollection<EntityComponent>.GetEnumerator()
    FastCollection<EntityComponent>.Sort()
    FastCollection<EntityComponent>.Sort(IComparer<EntityComponent>)
    FastCollection<EntityComponent>.Sort(Int32, Int32, IComparer<EntityComponent>)
    FastCollection<EntityComponent>.ICollection<EntityComponent>.IsReadOnly
    FastCollection<EntityComponent>.EnsureCapacity(Int32)

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    ArrayExtensions.ComputeHash<T>(ICollection<T>, IEqualityComparer<T>)
    CollectionExtensions.SwapRemove<T>(IList<T>, T)
    CollectionExtensions.SwapRemoveAt<T>(IList<T>, Int32)
    CollectionExtensions.GetItemOrNull<T>(IList<T>, Int32)
    CollectionExtensions.IndexOf<T>(IReadOnlyList<T>, T)
    EnumerableExtensions.IsNullOrEmpty(IEnumerable)
    EnumerableExtensions.ForEach<T>(IEnumerable, Action<T>)
    EnumerableExtensions.ForEach<T>(IEnumerable<T>, Action<T>)
    EnumerableExtensions.IndexOf<T>(IEnumerable<T>, Func<T, Boolean>)
    EnumerableExtensions.LastIndexOf<T>(IEnumerable<T>, Func<T, Boolean>)
    EnumerableExtensions.NotNull<T>(IEnumerable<T>)
    EnumerableExtensions.ToHashCode<T>(IEnumerable<T>)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation