共用方式為


ForEach<T>.Body 屬性

定義

要針對 ActivityAction 集合中每個項目執行的 Values

public:
 property System::Activities::ActivityAction<T> ^ Body { System::Activities::ActivityAction<T> ^ get(); void set(System::Activities::ActivityAction<T> ^ value); };
public System.Activities.ActivityAction<T> Body { get; set; }
member this.Body : System.Activities.ActivityAction<'T> with get, set
Public Property Body As ActivityAction(Of T)

屬性值

要執行的動作。

範例

下列程式碼範例將示範如何設定 ForEach<T> 活動的 Body 屬性。

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))
        }
    }
},

適用於