コード例 #1
0
        static void Main(string[] args)
        {
            AsyncAwaitDemo demo = new AsyncAwaitDemo();

            demo.DoStuff();

            for (int i = 0; i < 100; i++)
            {
                Console.WriteLine("Working on the Main Thread...................");
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            AsyncAwaitDemo demo = new AsyncAwaitDemo();

            demo.LongOperation();
            demo.FindFiles();

            // Two tasks are running in the background, while the main thread performs

            for (int i = 0; i < 100; i++)
            {
                Console.WriteLine("Working on the Main Thread...................");
            }

            Console.ReadLine();
        }