| LinqHelperForEachT Method (IEnumerableT, ActionT, Int32) |
Immediately performs the given action on each element (incorporating its index) in a
sequence.
Namespace: DigitalRune.LinqAssembly: DigitalRune (in DigitalRune.dll) Version: 1.20.0.0 (1.20.1.14552)
Syntax public static void ForEach<T>(
this IEnumerable<T> source,
Action<T, int> action
)
<ExtensionAttribute>
Public Shared Sub ForEach(Of T) (
source As IEnumerable(Of T),
action As Action(Of T, Integer)
)
public:
[ExtensionAttribute]
generic<typename T>
static void ForEach(
IEnumerable<T>^ source,
Action<T, int>^ action
)
[<ExtensionAttribute>]
static member ForEach :
source : IEnumerable<'T> *
action : Action<'T, int> -> unit
Parameters
- source
- Type: System.Collections.GenericIEnumerableT
A sequence that contains the elements on which to perform action.
- action
- Type: SystemActionT, Int32
The action to execute on each element; the second parameter of the function represents the
index of the element.
Type Parameters
- T
- The type of elements.
Return Value
Type:
The sequence of elements.
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).
Exceptions Remarks See Also