CSharp examples for System.Collections:IEnumerable
For Each in IEnumerable by Action
using System.Collections.Generic; using System.Collections; using System;/* w w w. j a v a 2 s . c o m*/ public class Main{ internal static void ForEach<T>(IEnumerable<T> collection, Action<T> action) { if (collection == null) throw new ArgumentNullException("collection"); if (action == null) throw new ArgumentNullException("action"); foreach (T item in collection) action(item); } }