You are implementing a new method named ProcessData. The ProcessData() method calls a third-party component that performs a long-running operation to retrieve stock information from a web service.
The third party component uses the IAsyncRcsult pattern to signal completion of the long-running operation so that the UI can be updated with the new values.
You need to ensure that the calling code handles the long-running operation as a 5ystem.Threading_Tasks.Task object to avoid blocking the Ul thread.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A . Apply the async modifier to the ProcessData() method signature.
B . Call the component by using the TaskFactory FromAsync() method.
C . Apply the following attribute to the ProcessDataO method signature:
[Methodlmpl (MetrhodlmplOptiions . Synchronized) ]
D . Create a TaskCompletionSource<T> object.
Answer: BD
Leave a Reply