NativeActivity.Execute(NativeActivityContext) Method

Definition

When implemented in a derived class, runs the activity's execution logic.

C#
protected abstract void Execute(System.Activities.NativeActivityContext context);

Parameters

context
NativeActivityContext

The execution context in which the activity executes.

Examples

The following code sample demonstrates using Cancel in a class that inherits from NativeActivity<TResult>. This example is from the Non-Generic ParallelForEach sample.

C#
protected override void Cancel(NativeActivityContext context)
{
    // If we don't have a completion condition then we can just
    // use default logic.
    if (this.CompletionCondition == null)
    {
        base.Cancel(context);
    }
    else
    {
        context.CancelChildren();
    }
}

Applies to

Product Versions
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1