CSharp examples for System.Collections.Generic:IEnumerable
Apply Action on Each Element of an IEnumerable
using System.Threading.Tasks; using System.Text; using System.Linq; using System.Collections.Specialized; using System.Collections.Generic; using System;/* www. j a v a2 s. c o m*/ public class Main{ public static IEnumerable<T> Each<T>(this IEnumerable<T> source, Action<T> action) { if (source != null) { foreach (var item in source) { action(item); } } return source; } }