ForEach

using System;
using System.Collections.Generic;

namespace Extensions
{
    static class Extensions
    {
        public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
        {
            foreach (var item in source)
                action(item);
        }
    }
}
Example:
            List<string> names = new List<string> { "beatle", "assassin", "chrisis", "erique", "fanlan" };
            names.ForEach(name => Console.WriteLine(name));

Description

Shortcut for foreach

Details

Double click on the code to select all.

 

;