Using the CodeActivity Activity
The CodeActivity activity is a simple form of a custom activity that enables you to easily add C# or Visual Basic code to any part of a workflow. Code that is entered in the CodeActivity activity resides in the code-separation file that is compiled with the workflow.
Use the CodeActivity activity to run any method that you specify. The code-separation method that you implement typically acts upon instance state and manipulates local variables. The method executes synchronously and does not yield the thread until the method has finished. The method is expected to be performant and should not block the workflow with a dependency on an external resource. For example, the CodeActivity activity generally should not invoke a Web service.
For more information about the CodeActivity activity, see the CodeActivity class of the System.Workflow.Activities namespace in the Windows Workflow Foundation Class Library reference.
For a code sample that demonstrates how to use the CodeActivity activity, see Simple Sequential Workflow.