nerdexam
Microsoft

70-511 · Question #20

You develop a Windows Presentation Foundation (WPF) application. This application is used to output data trends to customer service representatives. A data trend analysis is performed in a function…

The correct answer is B. Use ThreadPool.QueueUserWorkItem to invoke UpdateData. See the full explanation below for the reasoning.

Question

You develop a Windows Presentation Foundation (WPF) application. This application is used to output data trends to customer service representatives. A data trend analysis is performed in a function named UpdateTrendData. The trend analysis is a long-running process. The application contains the following code segment. Class MainWindow: Window { private void UpdateData(object arg) { double data = UpdateTrendData(); ... } } UpdateData is currently invoked on the UI thread when the form is first displayed. You need to process the data in a manner that does not cause the UI to freeze. What should you do?

Options

  • AUse ThreadPool.SetMaxThreads(2, 2) and invoke UpdateData.
  • BUse ThreadPool.QueueUserWorkItem to invoke UpdateData.
  • CUse this.Dispatcher.Beginlnvoke to invoke UpdateData passing in the priority of Normal.
  • DUse this.Dispatcher.BeginInvoke to invoke UpdateData passing in the priority of Background.

How the community answered

(24 responses)
  • A
    8% (2)
  • B
    83% (20)
  • C
    4% (1)
  • D
    4% (1)

Community Discussion

No community discussion yet for this question.

Full 70-511 Practice