You are creating a Windows Workflow Foundation custom activity by using Microsoft .NET Framework 3.5. The custom activity configures a workflow queue and subscribes to the QueueItemAvailable event. You need to ensure that the custom activity removes an item from the queue in the QueueItemAvailable event handler. Which code segment should you use?
A.
void queue_QueueItemAvailable(object sender, QueueEventArgs e){ WorkflowRuntime runtime = sender as WorkflowRuntime; WorkflowInstance instance = runtime.GetWorkflow(this.WorkflowInstanceId); object data = instance.GetWorkflowQueueData()[0].Items;}
B.
void queue_QueueItemAvailable(object sender, QueueEventArgs e){ ActivityExecutionContext context = sender as ActivityExecutionContext; WorkflowQueuingService service = context.GetService<WorkflowQueuingService>(); WorkflowQueue queue = service.GetWorkflowQueue(e.QueueName); object data = queue.Dequeue();}
C.
void queue_QueueItemAvailable(object sender, QueueEventArgs e){ ActivityExecutionContext context
= sender as ActivityExecutionContext; WorkflowQueuingService service = context.GetService<WorkflowQueuingService>(); WorkflowQueue queue = service.GetWorkflowQueue(e.QueueName); object data = queue.Peek(); }
D.
void queue_QueueItemAvailable(object sender, QueueEventArgs e){ WorkflowRuntime runtime = sender as WorkflowRuntime; WorkflowQueuingService service = runtime.GetService<WorkflowQueuingService>(); WorkflowQueue queue = service.GetWorkflowQueue(e.QueueName); object data = queue.Dequeue(); }