Click or drag to resize
DigitalRuneLinqHelperDoT Method (IEnumerableT, ActionT, Int32)
Performs the given action on each element (incorporating its index) in a sequence when it is enumerated.

Namespace: DigitalRune.Linq
Assembly: DigitalRune (in DigitalRune.dll) Version: 1.20.0.0 (1.20.1.14552)
Syntax
public static IEnumerable<T> Do<T>(
	this IEnumerable<T> source,
	Action<T, int> action
)

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: IEnumerableT
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
ExceptionCondition
ArgumentNullExceptionsource or action is .
Remarks
DoT(IEnumerableT, ActionT, Int32) is similar to ForEachT(IEnumerableT, ActionT, Int32). The difference is that ForEachT(IEnumerableT, ActionT, Int32) immediately enumerates the given sequence. DoT(IEnumerableT, ActionT, Int32) does not automatically trigger the enumeration. Instead it returns the IEnumerableT.
See Also