EnumerableExtensions.ForEach<T> Method

Execute action for each element of sequence.

Namespace: Microsoft.Practices.EnterpriseLibrary.Common.Utility
Assembly: Microsoft.Practices.EnterpriseLibrary.Common (in Microsoft.Practices.EnterpriseLibrary.Common.dll) Version: 6.0.0.0 (6.0.1304.0)

Syntax

public static void ForEach<T>(
    this IEnumerable<T> sequence,
    Action<T> action
)
'Declaration
<ExtensionAttribute> 
Public Shared Sub ForEach(Of T) ( 
    sequence As IEnumerable(Of T),
    action As Action(Of T)
)
public:
[ExtensionAttribute]
generic<typename T>
static void ForEach(
    IEnumerable<T>^ sequence, 
    Action<T>^ action
)

Parameters

Type Parameters

  • T
    Type of items in sequence.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<T>. 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

EnumerableExtensions Class

EnumerableExtensions Members

Microsoft.Practices.EnterpriseLibrary.Common.Utility Namespace