Introduction: A rule condition is a condition that can be evaluated to a Boolean value. It features validation and cloning facilities, as well as a dependency management mechanism. A rule action represents an action to be executed. A rule set is a collection of rules that can be executed and validated as a group. Rule or a Rule condition is involved as a property in an activity or a workflow, the design-time editors for the rule or rule condition use these dialogs.
Step 1 : Open Visual Studio2010.
- Go to File->New->Project.
- Select Sequential Workflow Console Application.

When we click in OK button then following [Design] window opens.

Step 2 : Drag activity from Toolbox and define activity name.
- Drag CodeActivity from Toolbox.

Step 3 : Now we double-click in
CodeActivity and write the below code.
Code :
using
System;
using
System.ComponentModel;
using
System.ComponentModel.Design;
using
System.Collections;
using
System.Collections.Generic;
using
System.Linq;
using
System.Workflow.ComponentModel.Compiler;
using
System.Workflow.ComponentModel.Serialization;
using
System.Workflow.ComponentModel;
using
System.Workflow.ComponentModel.Design;
using
System.Workflow.Runtime;
using
System.Workflow.Activities;
using
System.Workflow.Activities.Rules;
namespace
my_workflow
{
public sealed
partial class
Workflow1 :
SequentialWorkflowActivity
{
public
Dictionary<int,
string> cities = new
Dictionary<int,
string>();
public string
FromCity;
public string
ToCity;
public Workflow1()
{
InitializeComponent();
cities.Add(1, "allahabad");
cities.Add(2, "london");
cities.Add(3, "india");
cities.Add(4, "noida");
cities.Add(5, "delhi");
cities.Add(6, "banglore");
cities.Add(7, "istanbul");
cities.Add(8, "japan");
}
private void
codeActivity1_ExecuteCode(object sender,
EventArgs e)
{
Console.WriteLine("Enter
Passenger Name : ");
string passengerName =
Console.ReadLine();
Console.WriteLine("Enter
Departure City :");
this.FromCity =
Console.ReadLine();
Console.WriteLine("Enter
Destination City :");
this.ToCity =
Console.ReadLine();
}




Join the conversation! Your thoughts help the community grow.