Hi
In Main i want to call Start()
static void Main(string[] args)
{
Start();
}
async Task Start()
{}
Thanks
Hi
In Main i want to call Start()
static void Main(string[] args)
{
Start();
}
async Task Start()
{}
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Amit MohantyPosted Apr 8, 2024, 10:53 AM
If you want to call an asynchronous method Start() from the Main method, you'll need to make the Main method asynchronous as well.
If you prefer not to make the Main method asynchronous, you can achieve this by running the asynchronous method Start() synchronously using Task.Run() inside Main().
Jayraj ChhayaPosted Apr 8, 2024, 10:29 AM
Ramco RamcoPosted Apr 8, 2024, 10:26 AM
Hi
It is giving message The await operator can only be used within an async method.
Thanks
Tahir AnsariPosted Apr 8, 2024, 10:22 AM