IIterable<T> Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Exposes an iterator that supports simple iteration over a collection of a specified type.
.NET This interface appears as System.Collections.Generic.IEnumerable<T>. In any case where a Windows Runtime type has implemented IIterable<T>, .NET code can use the APIs of IEnumerable<T> instead. C# code can use foreach, Visual Basic code can use For Each...Next. All the .NET extension methods that are based on IEnumerable<T> and included in .NET for UWP apps are accessible (including the System.Linq extensions, so long as you've included the namespace).
public interface class IIterable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.FoundationContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(4205151722, 25108, 16919, 175, 218, 127, 70, 222, 88, 105, 179)]
template <typename T>
struct IIterable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.FoundationContract), 65536)]
[Windows.Foundation.Metadata.Guid(4205151722, 25108, 16919, 175, 218, 127, 70, 222, 88, 105, 179)]
public interface IEnumerable<T>
Public Interface IEnumerable(Of T)
Type Parameters
- T
- Attributes
Windows requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.FoundationContract (introduced in v1.0)
|
Remarks
When programming with .NET, this interface is hidden and developers should use the System.Collections.Generic.IEnumerable<T> interface. Because of how the projections were done, the GetEnumerator method isn't always available as a direct callable method on the types that project IEnumerable<T> as implemented, but enumerating the collection with the standard enumeration syntax (foreach) is still supported. The compiler does the type-casting for you and you won't need to cast to IEnumerable
explicitly. If you do need to cast explicitly, for example if you want to call GetEnumerator from a class, cast to IEnumerab<T>, using a constraint in the cast that matches the item type of the collection.
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.
Methods
First() |
Returns an iterator for the items in the collection. |