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 at the specified index. Triggers OnComponentAdded(GameComponentCollectionEventArgs).
protected override void InsertItem(int index, IGameComponent item)
Parameters
index
intThe zero-based index at which item should be inserted.
item
IGameComponentThe object to insert.
Exceptions
- ArgumentException
Specified IGameComponent is already present in the collection.
RemoveItem(int)
Removes the element at the specified index of the GameComponentCollection. Triggers OnComponentRemoved(GameComponentCollectionEventArgs).
protected override void RemoveItem(int index)
Parameters
index
intThe zero-based index of the element to remove.
SetItem(int, IGameComponent)
Replaces the element at the specified index.
protected override void SetItem(int index, IGameComponent item)
Parameters
index
intThe zero-based index of the element to replace.
item
IGameComponentThe new value for the element at the specified index.
Remarks
This method is not supported and will always throw NotSupportedException
Exceptions
- NotSupportedException
Thrown always
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