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 : IList<TimelineMarker>, IEnumerable<TimelineMarker>
The TimelineMarkerCollection class has these types of members:
The TimelineMarkerCollection class has these constructors.
|TimelineMarkerCollection||Initializes a new instance of the TimelineMarkerCollection class.|
The TimelineMarkerCollection class has these methods. It also inherits methods from the Object class.
|Add [C#, VB]||Adds a new item to the collection.|
|Append [C++]||Adds a new item to the collection.|
|Clear||Removes all items from the collection.|
|Contains [C#, VB]||Determines whether an element is in the collection.|
|CopyTo [C#, VB]||Copies the elements of the collection to an array, starting at a particular array index.|
|First [C++]||Returns an iterator for the items in the collection.|
|GetAt [C++]||Returns the item located at the specified index.|
|GetMany [C++]||Retrieves multiple elements in a single pass through the iterator.|
|GetView [C++]||Gets an immutable view into the collection.|
|IndexOf [C++]||Retrieves the index of the specified item.|
|IndexOf [C#, VB]||Determines the index of a specific item in the collection.|
|Insert [C#, VB]||Inserts an item into the collection.|
|InsertAt [C++]||Inserts the specified item.|
|Remove [C#, VB]||Removes the first occurrence of a specific object from the collection.|
|RemoveAt [C++]||Removes the item at the specified index.|
|RemoveAt [C#, VB]||Removes the element at the specified index of the collection.|
|RemoveAtEnd [C++]||Removes the last item in the collection.|
|ReplaceAll [C++]||Initially clears the collection, then inserts the provided array as new items.|
|SetAt [C++]||Sets the value at the specified index to the TimelineMarker value specified.|
The TimelineMarkerCollection class has these properties.
Count [C#, VB]
|Read-only||Gets the number of elements contained in the collection.|
IsReadOnly [C#, VB]
|Read-only||Gets a value indicating whether the collection is read-only.|
Item [C#, VB]
|Read/write||Gets or sets the element at the specified index.|
|Read-only||Gets the size (count) of the collection.|
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.
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.
Minimum supported client
|Windows 8 [Windows Store apps only]|
Minimum supported server
|Windows Server 2012 [Windows Store apps only]|
Minimum supported phone
|Windows Phone 8.1 [Windows Runtime apps only]|