C# language refference_2
uses a for statement to write out the integer values 1 through 10. 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