ForEach<T> Constructor

.NET Framework 4.6 and 4.5

Creates a new instance of the ForEach<T> class.

Namespace:  System.Activities.Statements
Assembly:  System.Activities (in System.Activities.dll)

public ForEach()

The following code sample demonstrates creating a ForEach<T> activity. This example is from the DynamicActivity Creation sample.

new ForEach<int>
{
    Values =  new ArgumentValue<IEnumerable<int>> { ArgumentName = "Numbers" },                                
    Body = new ActivityAction<int>
    {
        Argument = iterationVariable,
        Handler = new Assign<int>
        {
            To = accumulator,
            Value = new InArgument<int>(env => iterationVariable.Get(env) +  accumulator.Get(env))
        }
    }
},

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft