EnumerableExtensions.

Each<T>(IEnumerable<T>, Action<T>) Method

Summary

Performs an action on a collection of items

Syntax

public static void Each<T>(this IEnumerable<T> source, Action<T> action)

Examples

Replace the following
foreach(var item in items) 
{
  Debug.WriteLine(item);
}
with
items.Each(item => Debug,WriteLine(item));

Type Parameters

Name Description
T The item type

Parameters

Name Type Description
source IEnumerable<T> the collection
action Action<T> the action to perform

Return Value

Type Description
void