コード例 #1
0
        public static void Main(String[] args)
        {
            writeCommandLineArgs(args);

            writeNumbers();

            writeNumberString();

            Console.WriteLine(MyMath.AddNumbers(5, 8));

            // start the print Threads
            Thread[] threads = spawnPrintThreads();
            // wait for all of the print Threads to complete
            foreach (Thread thread in threads)
            {
                thread.Join();
            }
            Console.WriteLine("All complex operations have been completed in Threads!\n");

            // start the print Tasks
            Task[] tasks = spawnPrintTasks();
            // wait for all of the print Tasks to complete
            Task.WaitAll(tasks);
            Console.WriteLine("All complex operations have been completed in Tasks!");
        }