Here is the good example to start with SP workflow using Visual studio.
Please follow the below steps:
1-Start with a Sequential Workflow. Start Visual Studio and create a new project from the template SharePoint --> Sequential Workflow.
2-In the next screen select the option Site Workflow.
3-In the next screen, leave the default option saying the user manually starts the Workflow.
4-Create Activity
What is an Activity?
A Workflow consists of a series of Activities. We can add Activities using the Toolbox. There are different types of Activities like Code Activity, SendEmail, etc.
5-Drag and drop a Code Activity from the toolbox.
6-Add code for the Activity, add code for this Activity. Double click on the codeActivity1
private void codeActivity1_ExecuteCode(object sender, EventArgs e)
{
using (SPWeb web = SPContext.Current.Web)
{
SPList list = web.Lists["Manager"];
foreach (SPListItem item in list.Items)
{
if (item["Address"] == null)
{
item["Address"] = "PLEASE SET THE ADDRESS!";
item.Update();
}
}
}
}
7-Build and Deploy the Solution.