I​Vector<​T> I​Vector<​T> I​Vector<​T> Interface

Definition

Represents a random-access collection of elements.

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

public : interface IVector<T>public interface IVector<T>Public Interface IVector<T>
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<T> 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<T> 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<T>.

Properties

Size Size Size

Gets the number of items in the vector.

public : unsigned short Size { get; }public uint Size { get; }Public ReadOnly Property Size As uint
Value
unsigned short uint uint

The number of items in the vector.

Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IList<T> interface.

See Also

Methods

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

Appends an item to the end of the vector.

public : void Append(T value)public void Append(T value)Public Function Append(value As T) As void
Parameters
value
T T T

The item to append to the vector.

Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IList<T> interface.

See Also

Clear() Clear() Clear()

Removes all items from the vector.

public : void Clear()public void Clear()Public Function Clear() As void
Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IList<T> interface.

See Also

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

Returns the item at the specified index in the vector.

public : T GetAt(unsigned int index)public T GetAt(UInt32 index)Public Function GetAt(index As UInt32) As T
Parameters
index
unsigned int UInt32 UInt32

The zero-based index of the item.

Returns
T T T

The item at the specified index.

Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IList<T> interface.

See Also

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

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

public : unsigned short GetMany(unsigned int startIndex, T[] items)public uint GetMany(UInt32 startIndex, T[] items)Public Function GetMany(startIndex As UInt32, items As T[]) As uint
Parameters
startIndex
unsigned int UInt32 UInt32

The zero-based index to start at.

items
T[] T[] T[]

An array to copy the items into.

Returns
unsigned short uint uint

A status code indicating the result of the operation.

Attributes

Remarks

When programming with .NET, this interface is hidden. Use the IList interface instead.

GetView() GetView() GetView()

Returns an immutable view of the vector.

public : IVectorView<T> GetView()public IReadOnlyList<T> GetView()Public Function GetView() As IReadOnlyList( Of T )
Returns
IVectorView<T> IReadOnlyList<T> IReadOnlyList<T>

The view of the vector.

Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IList<T> interface.

See Also

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

Retrieves the index of a specified item in the vector.

public : PlatForm::Boolean IndexOf(T value, unsigned int index)public bool IndexOf(T value, UInt32 index)Public Function IndexOf(value As T, index As UInt32) As bool
Parameters
value
T T T

The item to find in the vector.

index
unsigned int UInt32 UInt32

If the item is found, this is the zero-based index of the item; otherwise, this parameter is 0.

Returns
PlatForm::Boolean bool bool

true if the item is found; otherwise, false.

Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IList<T> interface.

If the index parameter is 0, it indicates that the item is the first item in the array or that the item was not found. To determine whether the item found is the first item, check the return value of this method before you check the index parameter. If the return value is true and index is 0, then the item is the first item in the array. If the return value is false, then the item was not found and index is 0.

See Also

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

Inserts an item at a specified index in the vector.

public : void InsertAt(unsigned int index, T value)public void InsertAt(UInt32 index, T value)Public Function InsertAt(index As UInt32, value As T) As void
Parameters
index
unsigned int UInt32 UInt32

The zero-based index.

value
T T T

The item to insert.

Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IList<T> interface.

See Also

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

Removes the item at the specified index in the vector.

public : void RemoveAt(unsigned int index)public void RemoveAt(UInt32 index)Public Function RemoveAt(index As UInt32) As void
Parameters
index
unsigned int UInt32 UInt32

The zero-based index of the vector item to remove.

Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IList<T> interface.

See Also

RemoveAtEnd() RemoveAtEnd() RemoveAtEnd()

Removes the last item from the vector.

public : void RemoveAtEnd()public void RemoveAtEnd()Public Function RemoveAtEnd() As void
Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IList<T> interface.

See Also

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

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

public : void ReplaceAll(T[] items)public void ReplaceAll(T[] items)Public Function ReplaceAll(items As T[]) As void
Parameters
items
T[] T[] T[]

The collection of items to add to the vector.

Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IList<T> interface.

See Also

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

Sets the value at the specified index in the vector.

public : void SetAt(unsigned int index, T value)public void SetAt(UInt32 index, T value)Public Function SetAt(index As UInt32, value As T) As void
Parameters
index
unsigned int UInt32 UInt32

The zero-based index at which to set the value.

value
T T T

The item to set.

Attributes

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IList<T> interface.

See Also

See Also