سلام دوست عزیز
امیدوارم این به دردت بخوره :
static void Main(string[] args)
{
// Creates and initializes a new ArrayList.
System.Collections.ArrayList myAL = new System.Collections.ArrayList();
myAL.Add("Hello");
myAL.Add("World");
myAL.Add("!");
// Displays the properties and values of the ArrayList.
System.Console.WriteLine("myAL");
System.Console.WriteLine(" Count: {0}", myAL.Count);
System.Console.WriteLine(" Capacity: {0}", myAL.Capacity);
System.Console.Write(" Values:");
PrintValues(myAL);
System.Console.ReadKey();
}
public static void PrintValues(System.Collections.IEnumerable myList)
{
foreach (System.Object obj in myList)
System.Console.Write(" {0}", obj);
System.Console.WriteLine();
}