ForEach(T) Method

Fabrica Bolos GLPK

Collapse imageExpand ImageCopy imageCopyHover image
Executes action on every element of source

Namespace: Common
Assembly: Optimization.Framework (in Optimization.Framework.dll) Version: 0.3.1036.0

Syntax

C#
public static void ForEach<T>(
	this IEnumerable<T> source,
	Action<T> action
)
Visual Basic
<ExtensionAttribute> _
Public Shared Sub ForEach(Of T) ( _
	source As IEnumerable(Of T), _
	action As Action(Of T) _
)
Visual C++
[ExtensionAttribute]
public:
generic<typename T>
static void ForEach(
	IEnumerable<T>^ source, 
	Action<T>^ action
)

Parameters

source
Type: System.Collections.Generic..::..IEnumerable<(Of <(<'T>)>)>
The source.
action
Type: System..::..Action<(Of <(<'T>)>)>
The action.

Type Parameters

T

[Missing <typeparam name="T"/> documentation for "M:Common.ExtensionMethods.ForEach``1(System.Collections.Generic.IEnumerable{``0},System.Action{``0})"]

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<(Of <(<'T>)>)>. When you use instance method syntax to call this method, omit the first parameter. For more information, see or .

Contracts

Requires
action != null
source != null

See Also