Home » C# Async Main

C# Async Main

From C# 7.1, C# compiler allows us to create asynchronous Main method.

It helps us to perform asynchronous tasks at entry level of the application. Main method may contain an await expression to perform asynchronous task.

The using System.Threading.Tasks; namespace is used to access Task type.

C# provides following valid asynchronous overloaded Main methods.

C# Asynchronous Main Example

Output:

This is async Main method 

In this example, an asynchronous Main method calls to another async method.

C# Asynchronous Main Method Example

Output:

length: 36006 

You may also like