Class GameComponentCollection
A collection of IGameComponent instances.
public sealed class GameComponentCollection : Collection<IGameComponent>, IList<IGameComponent>, ICollection<IGameComponent>, IReadOnlyList<IGameComponent>, IReadOnlyCollection<IGameComponent>, IEnumerable<IGameComponent>, IList, ICollection, IEnumerable
- Inheritance
-
GameComponentCollection
- Implements
- Inherited Members
Methods
ClearItems()
Removes every GameComponent from this GameComponentCollection. Triggers OnComponentRemoved(GameComponentCollectionEventArgs) once for each GameComponent removed.
protected override void ClearItems()
InsertItem(int, IGameComponent)
Inserts an element into the Collection<T> at the specified index.
protected override void InsertItem(int index, IGameComponent item)
Parameters
indexintThe zero-based index at which
itemshould be inserted.itemIGameComponentThe object to insert. The value can be null for reference types.
Exceptions
- ArgumentOutOfRangeException
indexis less than zero.-or-
indexis greater than Count.
RemoveItem(int)
Removes the element at the specified index of the Collection<T>.
protected override void RemoveItem(int index)
Parameters
indexintThe zero-based index of the element to remove.
Exceptions
- ArgumentOutOfRangeException
indexis less than zero.-or-
indexis equal to or greater than Count.
SetItem(int, IGameComponent)
Replaces the element at the specified index.
protected override void SetItem(int index, IGameComponent item)
Parameters
indexintThe zero-based index of the element to replace.
itemIGameComponentThe new value for the element at the specified index. The value can be null for reference types.
Exceptions
- ArgumentOutOfRangeException
indexis less than zero.-or-
indexis greater than Count.
Events
ComponentAdded
Event that is triggered when a GameComponent is added to this GameComponentCollection.
public event EventHandler<GameComponentCollectionEventArgs> ComponentAdded
Event Type
ComponentRemoved
Event that is triggered when a GameComponent is removed from this GameComponentCollection.
public event EventHandler<GameComponentCollectionEventArgs> ComponentRemoved