IVectorView<T> Interface

Definition

Represents an immutable view into a vector.

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

public interface class IVectorView : IIterable<T>
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.FoundationContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(3152149068, 45283, 17795, 186, 239, 31, 27, 46, 72, 62, 86)]
template <typename T>
struct IVectorView : IIterable<T>
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.FoundationContract), 65536)]
[Windows.Foundation.Metadata.Guid(3152149068, 45283, 17795, 186, 239, 31, 27, 46, 72, 62, 86)]
public interface IReadOnlyList<T> : IEnumerable<T>
Public Interface IReadOnlyList(Of T)
Implements IEnumerable(Of T)

Type Parameters

T
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.FoundationContract (introduced in v1.0)

Remarks

For read-write collections, the IVectorView<T> interface is still relevant, because the IVector.GetView method returns an IVectorView<T> instance.

If the underlying collection changes, methods and properties of the IVectorView<T> interface may throw an exception.

C++/WinRT If the underlying collection has changed, methods and properties may throw a hresult_changed_state exception.

C++/CX If the underlying collection has changed, methods and properties may throw a ChangedStateException exception.

When programming with .NET, this interface is hidden and developers should use the IReadOnlyList<T> interface if they want to implement a read-only vector/list type. In any case where a Windows Runtime type has implemented IVectorView<T>, .NET code can use the APIs of IReadOnlyList<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.

Interface inheritance

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

Properties

Size

Gets the number of items in the vector view.

Methods

GetAt(UInt32)

Returns the item at the specified index in the vector view.

GetMany(UInt32, T[])

Retrieves multiple items from the vector view beginning at the given index.

C++/WinRT The correct syntax for the C++/WinRT language projection is uint32_t GetMany(uint32_t startIndex, winrt::array_view<T> items);.

IndexOf(T, UInt32)

Retrieves the index of a specified item in the vector view.

Applies to