© { JSL }
77
Folded Corner:
Text Box: foreach Notes
foreach Notes
·foreach ( type identifier in expression )
wtype and identifier declare an iteration variable
wimplicitly readonly, can't be ref or out parameter
wexpression must be either
§an IEnumerable collection, or
§a "collection type"
wconversion must exist, could throw
w
ArrayList numbers = new ArrayList();
...
// fill numbers with 0 through 9
...
IEnumerator ie = numbers.GetEnumerator();
while (ie.MoveNext())
{
    int number = (int)ie.Current;
    Console.WriteLine(number);
}