TimelineMarkerCollection TimelineMarkerCollection TimelineMarkerCollection TimelineMarkerCollection Class

Definition

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 : sealed class TimelineMarkerCollection
struct winrt::Windows::UI::Xaml::Media::TimelineMarkerCollection
public sealed class TimelineMarkerCollection
Public NotInheritable Class TimelineMarkerCollection
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

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.

Constructors

TimelineMarkerCollection() TimelineMarkerCollection() TimelineMarkerCollection() TimelineMarkerCollection()

Initializes a new instance of the TimelineMarkerCollection class.

Properties

Size Size Size Size

Gets the size (count) of the collection.

Methods

Append(TimelineMarker) Append(TimelineMarker) Append(TimelineMarker) Append(TimelineMarker)

Adds a new item to the collection.

Clear() Clear() Clear() Clear()

Removes all items from the collection.

First() First() First() First()

Returns an iterator for the items in the collection.

GetAt(UInt32) GetAt(UInt32) GetAt(UInt32) GetAt(UInt32)

Returns the item located at the specified index.

GetMany(UInt32, TimelineMarker[]) GetMany(UInt32, TimelineMarker[]) GetMany(UInt32, TimelineMarker[]) GetMany(UInt32, TimelineMarker[])

Retrieves multiple elements in a single pass through the iterator.

GetView() GetView() GetView() GetView()

Gets an immutable view into the collection.

IndexOf(TimelineMarker, UInt32) IndexOf(TimelineMarker, UInt32) IndexOf(TimelineMarker, UInt32) IndexOf(TimelineMarker, UInt32)

Retrieves the index of the specified item.

InsertAt(UInt32, TimelineMarker) InsertAt(UInt32, TimelineMarker) InsertAt(UInt32, TimelineMarker) InsertAt(UInt32, TimelineMarker)

Inserts the specified item.

RemoveAt(UInt32) RemoveAt(UInt32) RemoveAt(UInt32) RemoveAt(UInt32)

Removes the item at the specified index.

RemoveAtEnd() RemoveAtEnd() RemoveAtEnd() RemoveAtEnd()

Removes the last item in the collection.

ReplaceAll(TimelineMarker[]) ReplaceAll(TimelineMarker[]) ReplaceAll(TimelineMarker[]) ReplaceAll(TimelineMarker[])

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

SetAt(UInt32, TimelineMarker) SetAt(UInt32, TimelineMarker) SetAt(UInt32, TimelineMarker) SetAt(UInt32, TimelineMarker)

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

See also