Skip to content

Latest commit

 

History

History
50 lines (31 loc) · 3.4 KB

File metadata and controls

50 lines (31 loc) · 3.4 KB
-api-id -api-type
T:Windows.Foundation.Collections.IVector`1
winrt interface

Windows.Foundation.Collections.IVector

-description

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.

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

C++/WinRT extension functions

Note

Extension functions exist on the C++/WinRT projection types for certain Windows Runtime APIs. For example, winrt::Windows::Foundation::IAsyncAction is the C++/WinRT projection type for IAsyncAction. The extension functions aren't part of the application binary interface (ABI) surface of the actual Windows Runtime types, so they're not listed as members of the Windows Runtime APIs. But you can call them from within any C++/WinRT project. See C++/WinRT functions that extend Windows Runtime APIs.

auto begin() const;

Returns an iterator to the first element of the collection, for use in C++ algorithms such as range-based for loops.

auto end() const;

Returns an iterator to one past the last element of the collection, for use in C++ algorithms such as range-based for loops.

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

-examples

-see-also

Collections (C++/CX), System.Collections.Generic.IList<T>