Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IIterator<T> interface

Supports iteration over a collection.

Template parameters

T

The type of objects to iterate.

Members

The IIterator<T> interface inherits from IInspectable. IIterator also has these types of members:

Methods

The IIterator<T> interface has these methods.

MethodDescription
get_Current

Gets the current item in the collection.

get_HasCurrent

Gets a value that indicates whether there is a current item or the iterator is at the end of the collection.

MoveNext

Advances the enumerator to the next item in the collection.

 

Examples

The following code example demonstrates how to use the IIterator interface.


comptr<Folder> spFolder;
hr = GetKnownFolder(FOLDERID_MusicFolder, &spFolder);
//...
comptr<IVectorView<IShellItem2>> spItems;
hr = pFolder->GetItems(&spItems);
//...
comptr<IIterator<IShellItem2>> spIter;
hr = spItems->First(&spIter);
//...
bool hasCurrent;
for (hr = spIter->get_HasCurrent(&hasCurrent); 
     SUCCEEDED(hr) && hasCurrent; 
     hr = spIter->MoveNext(&hasCurrent))
{
    comptr<IShellItem2> spAnItem;
    hr = spIter->get_Current(&spAnItem)
    //...
}


Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Header

Windows.Foundation.Collections.h

See also

IIterable

 

 

Community Additions

Show:
© 2014 Microsoft