UIElementCollection.First メソッド

定義

UIElementCollection 内の項目を反復処理できる反復子オブジェクトを返します。

public:
 virtual IIterator<UIElement ^> ^ First() = IIterable<UIElement ^>::First;
IIterator<UIElement> First();
public IIterator<UIElement> First();
function first()
Public Function First () As IIterator(Of UIElement)

戻り値

反復子オブジェクト。 反復子の現在位置は、0 インデックス位置、またはコレクションが空の場合はコレクションの末尾にあります。

実装

注釈

First によって返される反復子を保持する便利な方法は、自動型推論キーワード (keyword)で宣言されている変数に戻り値を割り当てることです。 次に、while ループの一部として IIterator API を使用します。 次に例を示します。

auto iterator1{ uieCollection.First() };
while (iterator1.HasCurrent())
{
    Windows::UI::Xaml::UIElement currentItem{ iterator1.Current() };
    // Your logic here that does something with currentItem.
    iterator1.MoveNext();
}
auto iterator1 = uieCollection->First();
while (iterator1->HasCurrent)
{
    auto currentItem = iterator1->Current;
    //your logic here that does something with currentItem
    iterator1->MoveNext();
}

適用対象

こちらもご覧ください