| CollectionExtensionsForEachT(IEnumerableT, ActionT, Int32) Method |
Performs the specified action on each element of the collection, providing also the index of the item.
Namespace: TomsToolbox.EssentialsAssembly: TomsToolbox.Essentials (in TomsToolbox.Essentials.dll) Version: 2.21.0+44d18b541fc9419ec3c549350a832394661b2a4d
XMLNS for XAML: Not mapped to an xmlns.
Syntax public static void ForEach<T>(
this IEnumerable<T> collection,
Action<T, int> action
)
<ExtensionAttribute>
Public Shared Sub ForEach(Of T) (
collection As IEnumerable(Of T),
action As Action(Of T, Integer)
)
Parameters
- collection IEnumerableT
- The collection.
- action ActionT, Int32
- 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