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

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<T>, .NET code can use the APIs of IList<T> instead.

Syntax

Declaration

public interface IVector<T>public interface IVector<T>Public Interface IVector<T>

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<T>, .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<T> interface represents a collection of objects of a specified type that can be individually accessed by index. Properties and methods of IVector<T> 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<T>.

Interface inheritance

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

Properties summary

Gets the number of items in the vector.

Methods summary

Appends an item to the end of the vector.

Removes all items from the vector.

Returns the item at the specified index in the vector.

Returns an immutable view of the vector.

Retrieves the index of a specified item in the vector.

Inserts an item at a specified index in the vector.

Removes the item at the specified index in the vector.

Removes the last item from the vector.

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

Sets the value at the specified index in the vector.

Properties

  • Size
    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

    Property Value

    • uint
      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<T> interface.

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

    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<T> interface.

  • Clear()
    Clear()
    Clear()
    Clear()

    Removes all items from the vector.

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

    Remarks

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

  • GetAt(System.UInt32)
    GetAt(System.UInt32)
    GetAt(System.UInt32)
    GetAt(System.UInt32)

    Returns the item at the specified index in the vector.

    public T GetAt(System.UInt32 index)public T GetAt(System.UInt32 index)Public Function GetAt(index As System.UInt32) As T

    Parameters

    • index
      System.UInt32
      System.UInt32
      System.UInt32
      System.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<T> interface.

  • GetView()
    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.

    Remarks

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

  • IndexOf(T,System.UInt32)
    IndexOf(T,System.UInt32)
    IndexOf(T,System.UInt32)
    IndexOf(T,System.UInt32)

    Retrieves the index of a specified item in the vector.

    public bool IndexOf(T value,System.UInt32 index)public bool IndexOf(T value,System.UInt32 index)Public Function IndexOf(value As T,index As System.UInt32) As bool

    Parameters

    • value
      T
      T
      T
      T

      The item to find in the vector.

    • index
      System.UInt32
      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
      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<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(System.UInt32,T)
    InsertAt(System.UInt32,T)
    InsertAt(System.UInt32,T)
    InsertAt(System.UInt32,T)

    Inserts an item at a specified index in the vector.

    public void InsertAt(System.UInt32 index,T value)public void InsertAt(System.UInt32 index,T value)Public Function InsertAt(index As System.UInt32,value As T) As void

    Parameters

    • index
      System.UInt32
      System.UInt32
      System.UInt32
      System.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<T> interface.

  • RemoveAt(System.UInt32)
    RemoveAt(System.UInt32)
    RemoveAt(System.UInt32)
    RemoveAt(System.UInt32)

    Removes the item at the specified index in the vector.

    public void RemoveAt(System.UInt32 index)public void RemoveAt(System.UInt32 index)Public Function RemoveAt(index As System.UInt32) As void

    Parameters

    • index
      System.UInt32
      System.UInt32
      System.UInt32
      System.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<T> interface.

  • RemoveAtEnd()
    RemoveAtEnd()
    RemoveAtEnd()
    RemoveAtEnd()

    Removes the last item from the vector.

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

    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[])
    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[]
      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<T> interface.

  • SetAt(System.UInt32,T)
    SetAt(System.UInt32,T)
    SetAt(System.UInt32,T)
    SetAt(System.UInt32,T)

    Sets the value at the specified index in the vector.

    public void SetAt(System.UInt32 index,T value)public void SetAt(System.UInt32 index,T value)Public Function SetAt(index As System.UInt32,value As T) As void

    Parameters

    • index
      System.UInt32
      System.UInt32
      System.UInt32
      System.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<T> interface.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.FoundationContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.GuidAttribute

Details

Assembly

Windows.Foundation.Collections.dll