Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Array.ForEach Generic Method

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

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

public static void ForEach<T> (
	T[] array,
	Action<T> action
)
J# supports the use of generic types and methods, but not the declaration of new ones.
JScript does not support generic types and methods.
Not applicable.

Type Parameters

T

The type of the elements of the array.

Parameters

array

The one-dimensional, zero-based Array on whose elements the action is to be performed.

action

The Action to perform on each element of array.

Exception typeCondition

ArgumentNullException

array is a null reference (Nothing in Visual Basic).

-or-

action is a null reference (Nothing in Visual Basic).

The Action 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.

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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

Show:
© 2014 Microsoft