Running tasks asynchronously
First, we will write a simple console application that needs to execute three methods, and execute them synchronously (one after the other).
Running multiple actions synchronously
In Visual Studio 2017, press Ctrl + Shift + N or go to File | New | Project....
In the New
Project dialog, in the Installed | Templates list, expand Visual C#, and select .NET Core. In the center list, select Console App (.NET Core), type the name as Ch12_Tasks
, change the location to C:\Code
, type the solution name as Chapter12
, and then click on OK.
In Visual Studio Code, create a directory named Chapter12
with a subfolder named Ch12_Tasks
, and open the Ch12_Tasks
folder. In the Integrated Terminal, execute the command: dotnet new console ...
Get C# 7 and .NET Core: Modern Cross-Platform Development - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.