如下的代码是关于C#通过foreach语句遍历arraylist演示的代码。

using System;
using System.Collections;
 
namespace Client.Chapter_4___Program_Control
{
  public class ForEaches
  {
    static void Main(string[] args)
    {
      ArrayList a = new ArrayList(10);
 
      foreach (int x in a)
      {
        Console.WriteLine(x);
      }
    }
  }
}