NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

1.7.10 The foreach statement

A foreach statement enumerates the elements of a collection, executing a statement for each element of the collection.

The example

using System;
using System.Collections;
class Test
{
   static void WriteList(ArrayList list) {
      foreach (object o in list)
         Console.WriteLine(o);      
   }
   static void Main() {
      ArrayList list = new ArrayList();
      for (int i = 0; i < 10; i++)
         list.Add(i);
      WriteList(list);
   }
}

uses a foreach statement to iterate over the elements of a list.