(If you're impatient, you can see the code before reading the article)
Sharepoint has a workflow engine, and you can develop workflows for Sharepoint using either Sharepoint Designer or Visual Studio. Today I'm going to focus on workflows that are created using Sharepoint Designer. A step in a workflow, such as "Copy item from List A to List B", is called an Activity.
Sharepoint Designer comes with a number of activities out of the box, but you can use Visual Studio to create custom activities that are surfaced to Sharepoint Designer. For example, if you saw the existing workflow "Copy item from List A to List B", but it wasn't quite what you wanted, you could create a custom activity for "Copy item from List A to List B and List C", and that activity would then show up in Sharepoint Designer when creating a workflow.
Lets dig into how you can create a custom activity for Sharepoint Designer using Visual Studio.