Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# 'Task' does not exist in the namespace 'System.Threading' [closed]

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Task;`

`namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World");
            Console.ReadLine();
        }
    }
}

I am just trying to get started off in C#, and as I was writing my helloworld, I met my first compilation error.

ERROR: Script compilation failed. [CompilationErrorException] error CS0234: The type or namespace name 'Task' does not exist in the namespace 'System.Threading' (are you missing an assembly reference?)

I am running the latest .NET editing in VScode. Hope for your help.

like image 371
Horizoner 2.0 Avatar asked Oct 21 '25 12:10

Horizoner 2.0


1 Answers

Are you looking for the Task in System.Threading.Tasks?

Note the 's' at the end.

Full reference is System.Threading.Tasks.Task, or for a using, System.Threading.Tasks.

like image 148
technophebe Avatar answered Oct 23 '25 01:10

technophebe