Table of Contents

Class GameComponentCollection

Namespace
Microsoft.Xna.Framework
Assembly
MonoGame.Framework.dll

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 ComponentRemoved once for each GameComponent removed.

protected override void ClearItems()

InsertItem(int, IGameComponent)

Inserts an element into the collection at the specified index. Triggers ComponentAdded.

protected override void InsertItem(int index, IGameComponent item)

Parameters

index int

The zero-based index at which item should be inserted.

item IGameComponent

The 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 ComponentRemoved.

protected override void RemoveItem(int index)

Parameters

index int

The 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 int

The zero-based index of the element to replace.

item IGameComponent

The 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

EventHandler<GameComponentCollectionEventArgs>

ComponentRemoved

Event that is triggered when a GameComponent is removed from this GameComponentCollection.

public event EventHandler<GameComponentCollectionEventArgs> ComponentRemoved

Event Type

EventHandler<GameComponentCollectionEventArgs>