As per this post, the top voted answer suggested that we can use async directly in main. Or I misunderstood it?
Can't specify the 'async' modifier on the 'Main' method of a console app
My main class:
public class Program
{
public static async Task Main(string[] args)
{
ApproveEvents ap = new ApproveEvents();
List<MyModel> result = new List<MyModel>();
result = await ap.ApproveAsync();
if (result.count > 0)
{
//do something here
}
}
}
And,
public class ApproveEvents
{
public async Task<List<MyModel>> ApproveAsync()
{
//blah blah
}
}
Visual Studio 2017 is complaining about no Main method for an entry point.
How should I resolve this?
project -> properties -> build -> Advanced -> Language version, make sure something is selected that is greater than or equal to 7.1, you made need to fiddle depending on what you have (latest Major release may not work) - TheGeneral