Return to Snippet

Revision: 10308
at December 17, 2008 11:34 by hoffstein


Initial Code
public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
{
    foreach (T item in source)
        action(item);
}

Initial URL

                                

Initial Description
This will allow you to use the LINQ ForEach method on any IEnumerable.

Initial Title
C# Extension Method To Add ForEach To Any IEnumerable

Initial Tags

                                

Initial Language
C#