Introduction : A FlowSwitch activity works like a FlowDecision except instead of being restricted to a True and False branch. Each branch of a FlowSwitch activity is called a FlowStep. The FlowSwitch activity is a template class(<T>) and use same as Switch Statement in C#.

Let see how to create FlowSwitch<T>activity :

Step : 1 Create an Workflow Console Application.

workflow.gif

Step : 2 Drag Flowchart activity to the designer to place the activities on the palette.

flow-chart-activity.gif

Step : 3 Drag a FlowSwitch activity to the bottom of the Workflow.

fcc1.gif

Step : 4 Drag a WriteLine activity to display a standard greeting message and set the Display Name Winter, Spring, Summer , Autumn and Default.

switch2.gif
Step : 5
Go to FlowSwitch and right-click.

Code :

CInt(((DateTime.Now.Month Mod 12) + 1) / 4)

Step : 6 Go to Program.cs file and write a code.

Code :

using System;
using System.Linq;
using System.Activities;
using System.Activities.Statements;
namespace WorkflowConsoleApplication13
{
class Program
{
static
void Main(string[] args)
{
WorkflowInvoker.Invoke(new Workflow1());
Console.WriteLine("Hi");
Console.WriteLine("bye");
Console.WriteLine("press enter ");
Console.ReadLine();
}
}
}

Step :7 Press F5 and run application.

result2.gif