- 
                Notifications
    You must be signed in to change notification settings 
- Fork 35
M_CodeJam_Collections_ArrayExtensions_ForEach__1
        Andrew Koryavchenko edited this page Jun 17, 2018 
        ·
        7 revisions
      
    Performs the specified action on each element of the specified array.
Namespace: CodeJam.Collections
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0
C#
public static void ForEach<T>(
	this T[] array,
	Action<T> action
)VB
<ExtensionAttribute>
Public Shared Sub ForEach(Of T) ( 
	array As T(),
	action As Action(Of T)
)F#
[<ExtensionAttribute>]
static member ForEach : 
        array : 'T[] * 
        action : Action<'T> -> unit 
- 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.
- T
- The type of the elements of the array.
In Visual Basic and C#, you can call this method as an instance method on any object of type . 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).
| Exception | Condition | 
|---|---|
| ArgumentNullException | array is null.-or-action is null. |