You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5.
You use the state machine workflow in the application. You plan to implement a mechanism that allows a host application to query a state machine workflow instance that is currently executing.
You write the following code segment. (Line numbers are included for reference only.)
01 WorkflowRuntime runtime = new WorkflowRuntime();
02 WorkflowInstance instance =
03 runtime.CreateWorkflow(typeof(Workflow1));
04 instance.Start();
You need to identify the current state of the workflow.
Which code segment should you insert at line 05?
A.
string currentstate = instance.GetWorkflowDefinition().ToString();
B.
string currentstate = instance.GetWorkflowDefinition().ExecutionStatus.ToString();
C.
StateMachineWorkflowInstance smwi = new StateMachineWorkflowInstance(runtime, instance.InstanceId);string currentstate = smwi.StateHistory[0];
D.
StateMachineWorkflowInstance smwi = new StateMachineWorkflowInstance(runtime, instance.InstanceId);string currentstate = smwi.CurrentStateName;