none
The Task Class RRS feed

  • Question

  • Please let someone help me. Under which namespace is the Task class that has Run() as a method?  I used the Task class Under the Systems.Threading.Tasks namespace and the intellisense showed that the Task class has no method called Run(). Below is the illustration of what I did:

    using Systems;

    using Systems.Threading.Tasks;

    namespace MyNamespace{

    class MyClass{

           public static void main(){

         Task t = Task.Run(() =>{

    //codes here

    });

    }

    }

    }

    Wednesday, March 16, 2016 4:07 PM

Answers

  • System.Threading.Task is the correct namespace.

    Although I see you have an extra 's' wherever you have the word System.

    (Its System and System.Threading.Task, not Systems or Systems.Threading.Task).

    Otherwise your code works perfectly fine for me.

    Wednesday, March 16, 2016 4:11 PM