Creating a WF program using OutArgument
In this task, we will create a WF program that can return a result to the Workflow host.
How to do it...
using System;
using System.Activities;
using System.Collections.Generic;
namespace UseOutArgument
{
class Program
static void Main(string[] args)
IDictionary<string, object> output =
WorkflowInvoker.Invoke(new Workflow1());
Console.WriteLine(output["OutMessage"]);
}
How it works...
Look at the following code snippet:
OutMessage is the name of OutArgument we defined in Workflow1.xaml. the WorkflowInvoder.Invoke method will return a IDictionary type object.
There's more...
There is a third type of Workflow argument: InOutArgument. It is a binding terminal that represents the flow of data into and out of an activity. In most cases, we can use InOutArgument instead of InArgument and OutArgument. But there are still some differences-for example, we cannot assign a string to InOutArgument, while it is allowed to assign a string to InArgument directly in the host program.