Click or drag to resize
EnumerableExtensionsForEachT Method
Performs the specified action on each element of the enumerable.

Namespace: Capgemini.CommonObjectUtils
Assembly: Capgemini.CommonObjectUtils (in Capgemini.CommonObjectUtils.dll) Version: 1.3.0.0
Syntax
public static void ForEach<T>(
	this IEnumerable<T> enumerable,
	Action<T> action
)

Parameters

enumerable
Type: System.Collections.GenericIEnumerableT
The enumerable to act on.
action
Type: SystemActionT
The action to take on each element.

Type Parameters

T
The type of elements held in the enumerable.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Examples
IEnumerable<int> myItems = ...

myItems.ForEach((x) => Console.WriteLine(x));
See Also