You can enumerate using the static Array.ForEach method:
public static void ForEach<T> (T[] array, Action<T> action);
This uses an Action delegate, with this signature:
public delegate void Action<T> (T obj);
using System;
using System.Collections;
class Sample
{
public static void Main()
{
Array.ForEach(new[] { 1, 2, 3 }, Console.WriteLine);
}
}
The output:
1
2
3
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |