IVector IVector IVector IVector 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>public interface IVector<T>Public Interface IVector<T>// You can use this interface in JavaScript.
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

Gets the number of items in the vector.

public : unsigned int Size { get; }public uint Size { get; }Public ReadOnly Property Size As uint// You can use this property in JavaScript.
Value
unsigned int uint uint uint

The number of items in the vector.

Remarks

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

See Also

Methods

Append(T) 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// You can use this method in JavaScript.
Parameters
value
T T T T

The item to append to the vector.

Remarks

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

See Also

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

Removes all items from the vector.

public : void Clear()public void Clear()Public Function Clear() As void// You can use this method in JavaScript.

Remarks

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

See Also

GetAt(UInt32) 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// You can use this method in JavaScript.
Parameters
index
unsigned int UInt32 UInt32 UInt32

The zero-based index of the item.

Returns
T T T T

The item at the specified index.

Remarks

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

See Also

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.

public : unsigned int GetMany(unsigned int startIndex, T[] items)public uint GetMany(UInt32 startIndex, T[] items)Public Function GetMany(startIndex As UInt32, items As T[]) As uint// You can use this method in JavaScript.
Parameters
startIndex
unsigned int UInt32 UInt32 UInt32

The zero-based index to start at.

items
T[] T[] T[] T[]

An array to copy the items into.

Returns
unsigned int uint uint uint

A status code indicating the result of the operation.

Remarks

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

GetView() 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 )// You can use this method in JavaScript.
Returns
IVectorView<T> IReadOnlyList<T> IReadOnlyList<T> IReadOnlyList<T>

The view of the vector.

Remarks

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

See Also

IndexOf(T, UInt32) 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// You can use this method in JavaScript.
Parameters
value
T T T T

The item to find in the vector.

index
unsigned int UInt32 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 bool

true if the item is found; otherwise, false.

Remarks

When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IList 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) 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// You can use this method in JavaScript.
Parameters
index
unsigned int UInt32 UInt32 UInt32

The zero-based index.

value
T T T T

The item to insert.

Remarks

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

See Also

RemoveAt(UInt32) 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// You can use this method in JavaScript.
Parameters
index
unsigned int UInt32 UInt32 UInt32

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

Remarks

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

See Also

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

Removes the last item from the vector.

public : void RemoveAtEnd()public void RemoveAtEnd()Public Function RemoveAtEnd() As void// You can use this method in JavaScript.

Remarks

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

See Also

ReplaceAll(T[]) 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// You can use this method in JavaScript.
Parameters
items
T[] T[] T[] T[]

The collection of items to add to the vector.

Remarks

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

See Also

SetAt(UInt32, T) 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// You can use this method in JavaScript.
Parameters
index
unsigned int UInt32 UInt32 UInt32

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

value
T T T T

The item to set.

Remarks

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

See Also

See Also