預設的 Console 應用程式
通常剛建立好一個 Console 應用程式專案,其主程式 Program.cs 的內容如下:
1
2
3
4
5
6
7
8
9
10
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
// Your code here
}
}
}
改成 async 非同步 Main() 方法
加上async,void 改成 Task
1
2
3
4
5
6
7
8
9
10
namespace ConsoleApp
{
class Program
{
static async Task Main(string[] args)
{
// Your code here
}
}
}