ForEach(T) Method

Array.ForEach(Of T) Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Performs the specified action on each element of the specified array.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
Public Shared Sub ForEach(Of T) ( _
	array As T(), _
	action As Action(Of T) _
)

Type Parameters

T

The type of the elements of the array.

Parameters

array
Type: T ()
The one-dimensional, zero-based Array on whose elements the action is to be performed.
action
Type: System.Action(Of T)
The Action(Of T) to perform on each element of array.

ExceptionCondition
ArgumentNullException

array is Nothing.

-or-

action is Nothing.

The Action(Of T) is a delegate to a method that performs an action on the object passed to it. The elements of array are individually passed to the Action(Of T).

This method is an O(n) operation, where n is the Length of array.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft