6

I read about the Dispatcher class in .NET. But curiously the System.Windows.Threading namespace does not exist in my case (MSDN). Do I get something wrong? Thanks for your help.

iDog
  • 361
  • 1
  • 3
  • 13

3 Answers3

5

Check your framework version and references (you need a reference to WindowsBase and framework version 3+ or Silverlight)

sehe
  • 374,641
  • 47
  • 450
  • 633
1

What type of project is it?
It might be because you are writing a "Class Library".
Check the "Output type:" on the application tab of the project properties.

It is not intuitive to me but it seems "using System.Threading;" in a "Class Library" does not give access to the Dispatcher type when the same using statement placed in a console or wpf project do.

Gerry
  • 11
  • 1
  • 4
    Check the answer. You need to add a reference to WindowsBase to your project to have access to the System.Threading namespace. – Metro Feb 17 '12 at 20:35
0

Add Reference WindowsBase, then add

using System.Windows.Threading;

so you will be able to use code like:

System.Windows.Threading.Dispatcher Dispatcher { get; set; }

screenshot: enter image description here

loki
  • 9,816
  • 7
  • 56
  • 82