How to: Create an Iterator Block for a List of Integers (C# Programming Guide)

In this example, an array of integers is used to build the list SampleCollection. A for loop iterates through the collection and yield returns the value of each item. Then a foreach loop is used to display the items of the collection.