i have a confusion regarding calling function asynchronously. see a sample code
private async void button1_Click(object sender, EventArgs e)
{
bool retvalue = await SimulateJob();
Console.WriteLine(retvalue);
}
private Task<bool> SimulateJob()
{
bool status = false;
//await Task.Delay(10000);
status = true;
return Task.FromResult(status);
}
1) if i remove async keyword from the function SimulateJob() then function will be treated as synchronous calling function ?
2) a asynchronous function has to have async keyword at the top of function declaration ?
3) is it mandatory to use async keyword if i need to call a function asynchronously ?
4) How many ways i can call a function asynchronously using Task & Await keyword?
please discuss this issue.
Thanks
