Dela via


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 ref class TimelineMarkerCollection sealed : IIterable<TimelineMarker ^>, IVector<TimelineMarker ^>
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class TimelineMarkerCollection final : IIterable<TimelineMarker>, IVector<TimelineMarker>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class TimelineMarkerCollection final : IIterable<TimelineMarker>, IVector<TimelineMarker>
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class TimelineMarkerCollection : IEnumerable<TimelineMarker>, IList<TimelineMarker>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[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)
Inheritance
Object Platform::Object IInspectable TimelineMarkerCollection
Attributes
Implements

Windows requirements

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

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 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 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.
  • If you use the GetAt method (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 IndexOf (for C++) to find a specific TimelineMarker in the ordered list.
  • If you use the SetAt method (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<T> with a TimelineMarker constraint.

Constructors

TimelineMarkerCollection()

Initializes a new instance of the TimelineMarkerCollection class.

Properties

Size

Gets the size (count) of the collection.

Methods

Append(TimelineMarker)

Adds a new item to the collection.

Clear()

Removes all items from the collection.

First()

Returns an iterator for the items in the collection.

GetAt(UInt32)

Returns the item located at the specified index.

GetMany(UInt32, TimelineMarker[])

Retrieves multiple elements in a single pass through the iterator.

GetView()

Gets an immutable view into the collection.

IndexOf(TimelineMarker, UInt32)

Retrieves the index of the specified item.

InsertAt(UInt32, TimelineMarker)

Inserts the specified item.

RemoveAt(UInt32)

Removes the item at the specified index.

RemoveAtEnd()

Removes the last item in the collection.

ReplaceAll(TimelineMarker[])

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