IVector<T> IVector<T> IVector<T> IVector<T> IVector<T> Interface

Definition

Represents a random-access collection of elements.

.NET This interface appears to .NET code as System.Collections.Generic.IList due to .NET language projection. In any case where a Windows Runtime type has implemented IVector;, .NET code can use the APIs of IList instead.

public : interface IVector<T> : IIterable<T>
struct winrt::Windows::Foundation::Collections::IVector<T> : IIterable<T>
public interface IVector<T> : IEnumerable<T>
Public Interface IVector<T> Implements IEnumerable<T>
// You can't instantiate an interface directly in JavaScript. You can use objects that implement the interface, however.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.FoundationContract (introduced v1)

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IList interface if they want to implement a vector/list type. In any case where a Windows Runtime type has implemented IVector;, .NET code can use the APIs of IList instead. This includes all the existing Windows Runtime API and also scenarios such as using the APIs of Windows Runtime components originally implemented in Visual C++ component extensions (C++/CX) from a C# or Visual Basic app.

The IVector; interface represents a collection of objects of a specified type that can be individually accessed by index. Properties and methods of IVector; support list-type functionality, such as getting the size of the collection, and adding and removing items at specified locations in the collection. Additionally, the GetView method provides a snapshot of the vector whose observable state does not change. The snapshot is useful when you need a view of the collection to refer to in subsequent operations that involve IVector;.

Interface inheritance

IVector inherits IIterable. Types that implement IVector also implement the interface members of IIterable. Similarly, if you're using .NET, there is support for IEnumerable.

Properties

Size Size Size Size Size

Gets the number of items in the vector.

Methods

Append(T) Append(T) Append(T) Append(T) Append(T)

Appends an item to the end of the vector.

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

Removes all items from the vector.

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

Returns the item at the specified index in the vector.

GetMany(UInt32, T[]) GetMany(UInt32, T[]) GetMany(UInt32, T[]) GetMany(UInt32, T[]) GetMany(UInt32, T[])

Gets a collection of items from the vector beginning at the given index.

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

Returns an immutable view of the vector.

IndexOf(T, UInt32) IndexOf(T, UInt32) IndexOf(T, UInt32) IndexOf(T, UInt32) IndexOf(T, UInt32)

Retrieves the index of a specified item in the vector.

InsertAt(UInt32, T) InsertAt(UInt32, T) InsertAt(UInt32, T) InsertAt(UInt32, T) InsertAt(UInt32, T)

Inserts an item at a specified index in the vector.

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

Removes the item at the specified index in the vector.

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

Removes the last item from the vector.

ReplaceAll(T[]) ReplaceAll(T[]) ReplaceAll(T[]) ReplaceAll(T[]) ReplaceAll(T[])

Replaces all the items in the vector with the specified items.

SetAt(UInt32, T) SetAt(UInt32, T) SetAt(UInt32, T) SetAt(UInt32, T) SetAt(UInt32, T)

Sets the value at the specified index in the vector.

See Also