Click or drag to resize

CollectionExtensionsForEachT Method (IEnumerableT, ActionT)

Performs the specified action on each element of the collection.

Namespace:  TomsToolbox.Essentials
Assembly:  TomsToolbox.Essentials (in TomsToolbox.Essentials.dll)
Syntax
public static void ForEach<T>(
	this IEnumerable<T> collection,
	Action<T> action
)

Parameters

collection
Type: System.Collections.GenericIEnumerableT
The collection.
action
Type: SystemActionT
The action.

Type Parameters

T
The type of elements in the collection.

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).
See Also