TimelineMarkerCollection Class


Represents a collection of TimelineMarker objects that can be individually accessed by index. A TimelineMarkerCollection is an ordered list where the order is determined by the Time value of each TimelineMarker item contained in the collection. For more info on how this affects the collection API, see Remarks.

public ref class TimelineMarkerCollection sealed : IIterable<TimelineMarker ^>, IVector<TimelineMarker ^>
class TimelineMarkerCollection sealed : IIterable<TimelineMarker>, IVector<TimelineMarker>
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class TimelineMarkerCollection : IEnumerable<TimelineMarker>, IList<TimelineMarker>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class TimelineMarkerCollection : IEnumerable<TimelineMarker>, IList<TimelineMarker>
Public NotInheritable Class TimelineMarkerCollection
Implements IEnumerable(Of TimelineMarker), IList(Of TimelineMarker)

Windows 10 requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)


Collection API for TimelineMarkerCollection

A TimelineMarkerCollection is an ordered list where the order is determined by the Time value of each TimelineMarker item contained in the collection. The collection API for TimelineMarkerCollection internally processes each new item that is added to the collection and adds it at an index location that corresponds to an updated ordering of all Time values for all TimelineMarker items in the collection.

The intention of having the TimelineMarkerCollection always maintain a Time -based order is so that enumerating/iterating the collection gives the TimelineMarker values in the order that corresponds to the Position of a media asset that's being played and the order that MarkerReached events would fire. Otherwise, if the collection weren't Time -ordered, it would have been necessary to sort the collection by time prior to use.

  • If you call Add (or Append for C++), the item might be added to the beginning, middle or end of the ordered list, depending on the Time value of the TimelineMarker you are adding.
  • If you call Insert (or InsertAt for C++) the index parameter is ignored. The TimelineMarker item is added at an index position that maintains the collection's order by Time values. Basically Insert will act identically to Add.
  • If you use the Item indexer (or GetAt for C++) to read a value, the index is correct, based on how the item was added by the internal logic. But since you didn't directly control that logic, it's usually a better idea to use Contains (IndexOf for C++) to find a specific TimelineMarker in the ordered list.
  • If you use the Item indexer (or SetAt for C++) to set a value, you will delete a value that was previously at that index, but the collection will reorder itself to maintain the Time value ordering, so the new TimelineMarker you added might not be at the index you were setting to. This is probably a bad idea, because you won't be sure which item gets deleted. We recommend you don't use the indexer to set values.
  • RemoveAt will remove the specified indexed item, but won't remove possible duplicate items when the collection index shifts for the remaining Time values. We recommend you don't use RemoveAt.

Enumerating the collection in C# or Microsoft Visual Basic

A TimelineMarkerCollection is enumerable, so you can use language-specific syntax such as foreach in C# to enumerate the items in the collection. The compiler does the type-casting for you and you won't need to cast to IEnumerable<TimelineMarker> explicitly. If you do need to cast explicitly, for example if you want to call GetEnumerator, cast to IEnumerable with a TimelineMarker constraint.



Initializes a new instance of the TimelineMarkerCollection class.



Gets the size (count) of the collection.



Adds a new item to the collection.


Removes all items from the collection.


Returns an iterator for the items in the collection.


Returns the item located at the specified index.

GetMany(UInt32, TimelineMarker[])

Retrieves multiple elements in a single pass through the iterator.


Gets an immutable view into the collection.

IndexOf(TimelineMarker, UInt32)

Retrieves the index of the specified item.

InsertAt(UInt32, TimelineMarker)

Inserts the specified item.


Removes the item at the specified index.


Removes the last item in the collection.


Initially clears the collection, then inserts the provided array as new items.

SetAt(UInt32, TimelineMarker)

Sets the value at the specified index to the TimelineMarker value specified.

Applies to

See also