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<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 uint Size { get; }public uint Size { get; }Public ReadOnly Property Size As uint
Value
uint 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.

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.

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.

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

Returns the item at the specified index in the vector.

public T GetAt(UInt32 index)public T GetAt(UInt32 index)Public Function GetAt(index As UInt32) As T
Parameters
index
System.UInt32 System.UInt32 System.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.

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

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

public uint GetMany(UInt32 startIndex, T[] items)public uint GetMany(UInt32 startIndex, T[] items)Public Function GetMany(startIndex As UInt32, items As T[]) As uint
Parameters
startIndex
System.UInt32 System.UInt32 System.UInt32

The zero-based index to start at.

items
T[] T[] T[]

An array to copy the items into.

Returns
uint 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 IVectorView<T> GetView()Public Function GetView() As IVectorView( Of T )
Returns

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.

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

Retrieves the index of a specified item in the vector.

public bool IndexOf(T value, UInt32 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
System.UInt32 System.UInt32 System.UInt32

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

Returns
bool 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.

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

Inserts an item at a specified index in the vector.

public void InsertAt(UInt32 index, T value)public void InsertAt(UInt32 index, T value)Public Function InsertAt(index As UInt32, value As T) As void
Parameters
index
System.UInt32 System.UInt32 System.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.

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

Removes the item at the specified index in the vector.

public void RemoveAt(UInt32 index)public void RemoveAt(UInt32 index)Public Function RemoveAt(index As UInt32) As void
Parameters
index
System.UInt32 System.UInt32 System.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.

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.

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.

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

Sets the value at the specified index in the vector.

public void SetAt(UInt32 index, T value)public void SetAt(UInt32 index, T value)Public Function SetAt(index As UInt32, value As T) As void
Parameters
index
System.UInt32 System.UInt32 System.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