Microsoft Exam Questions

Which code segment should you use?

You create a Windows Workflow Foundation application by using Microsoft .NET Framework 3.5. The application uses state machineCbased workflows. As the workflow progresses, each state requires the name of the previous state. The workflow must be able to return the previous state at any point during the workflow. You need to create a method that returns the name of the last state. Which code segment should you use?

A.
StateMachineWorkflowInstance wi = new StateMachineWorkflowInstance(runtime, workflowId);return wi.StateHistory[0];

B.
StateMachineWorkflowInstance wi = new StateMachineWorkflowInstance(runtime, workflowId);return wi.CurrentState.Parent.Name;

C.
StateMachineWorkflowInstance wi = new StateMachineWorkflowInstance(runtime, workflowId);return wi.States[wi.States.Count – 1].Name;

D.
StateMachineWorkflowInstance wi = new StateMachineWorkflowInstance(runtime, workflowId);return wi.StateHistory[wi.StateHistory.Count – 1];