If it's a console app then you have to use
Async is as below.
Note: This is just a sample.Adjust it according to your app.
class Program
{
static int Main(string[] args)
{
try
{
return AsyncContext.Run(() => MainAsync(args));
}
catch (Exception ex)
{
Console.Error.WriteLine(ex);
return -1;
}
}
static async Task<int> MainAsync(string[] args)
{
...
}
}
Read for more info : Async Console Programs