IVector<T>.GetMany(UInt32, T[]) 方法

定義

從指定索引開始的向量擷取多個專案。

C++/WinRT C++/WinRT 語言投影的正確語法為 uint32_t GetMany(uint32_t startIndex, winrt::array_view<T> items);

public:
 unsigned int GetMany(unsigned int startIndex, Platform::Array <T> ^ items);
uint32_t GetMany(uint32_t const& startIndex, winrt::array_view <T> & items);
public uint GetMany(uint startIndex, T[] items);
Public Function GetMany (startIndex As UInteger, items As T()) As UInteger

參數

startIndex
UInt32

unsigned int

uint32_t

要從開始之以零起始的索引。

items
T[]

陣列,接收從向量複製的專案。

C++/WinRTwinrt::array_view,接收從向量複製的專案。

傳回

UInt32

unsigned int

uint32_t

已擷取的專案數目。 如果達到向量結尾,這個值可以小於 專案 的大小。

備註

使用 .NET 進行程式設計時,會隱藏這個介面。 請改用 IList 介面。

C++/WinRT除了傳遞winrt::array_view < T >之外,您還可以傳遞任何可轉換成winrt::array_view < T >的物件,例如這些範例。

  • C++ std::array < T, N >
  • T的 C 樣式陣列
  • C++ std::vector < T >
  • { pointer, length }, where pointer is a pointer to a buffer of T objects, and length is the number of entries in the buffer
  • { first, last }, where first and last 代表 T 物件的範圍 [first, last)

如果開始索引大於集合的大小,則檢視會擲回例外狀況。

C++/WinRT 如果開始索引大於集合的大小,則檢視會擲回 hresult_out_of_bounds 例外狀況。

C++/CX 如果開始索引大於集合的大小,則檢視會擲回 OutOfBoundsException 例外狀況。

適用於