ArrayList foreach : Foreach « Language Basics « C# / C Sharp






ArrayList foreach

/*
 * C# Programmers Pocket Consultant
 * Author: Gregory S. MacBeth
 * Email: gmacbeth@comporium.net
 * Create Date: June 27, 2003
 * Last Modified Date:
 */
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);
      }
    }
  }
}

           
       








Related examples in the same category

1.Hashtable and foreachHashtable and foreach
2.Use the foreach loopUse the foreach loop
3.Use break with a foreachUse break with a foreach
4.Use foreach on a two-dimensional arrayUse foreach on a two-dimensional array
5.Search an array using foreachSearch an array using foreach
6.a foreach loopa foreach loop
7.Sums the values in an array using a foreach loopSums the values in an array using a foreach loop
8.Queue enqueue and foreachQueue enqueue and foreach
9.Stack push and foreachStack push and foreach
10.Foreach for arraylistForeach for arraylist