LoginSignup
0
1

More than 3 years have passed since last update.

C#メモ 非同期main

Posted at

~C# 7.0

using System;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        MainAsync().Wait();
    }

    private static async Task MainAsync()
    {
        await Task.Delay(2000);
        Console.WriteLine("Hello World!");
    }
}

C# 7.1~

using System;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        await Task.Delay(2000);
        Console.WriteLine("Hello World!");
    }

}
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1