Export (0) Print
Expand All
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<T> Method

July 28, 2014

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
)

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<T>
The Action<T> to perform on each element of array.

ExceptionCondition
ArgumentNullException

array is null.

-or-

action is null.

The Action<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<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:
© 2014 Microsoft