The name 'Tasks' does not exists in current context

Viewed 5903

Following script to play a sound. Sound length 6 seconds which plays repeating for 6 seconds

Task.Factory.StartNew<int>(() =>
{
    while (isSoundOn)
    {
        player.Play();
        Thread.Sleep(6000);
    }
    return 1;
 });

Everything is working fine for .Net Framework 4 but I have need to build for .Net Framework 3.

When I use .Net Framework 3 then it shows following error

The name 'Tasks' does not exists in current context

What will be the solution. Thanks in advance.

3 Answers

I am adding this because I lost some time searching for this.... All I had to add was the following...

using System.Threading.Tasks;
Related