Do I need to await a async Task function if it doesn't return anything? Will that cause the following code be wrapped in a delegate and executed after the async Task function returns?
Task DoSomethingAsync()
{
return Task.Run(() =>
{
// Do something, but doesn't return values.
});
}
void Test()
{
DoSomethingAsync(); // should I await?
// Do other things, totally not related to the async function
Console.WriteLine("aaa");
}
In above example, if I await DoSomethingAsync() in Test(), will that cause the following code Console.WriteLine be wrapped in delegate and defer executed only when the async task is done?