Reputation: 1894
ok so I have a function
public async Task Foo(){
await SomeOtherFunctionAsync();
Bar();
}
Bar() can't be made async, it only removes an entry from a dictionary.
What is the best approach in this case?
Upvotes: 0
Views: 184
Reputation: 35057
One great thing about programming is that it very often is very easy to try.
await Foo();
async Task Foo(){
await SomeOtherFunctionAsync();
Bar();
}
async Task SomeOtherFunctionAsync() {
await Task.Delay(TimeSpan.FromMilliseconds(100));
}
void Bar() {
Console.WriteLine("Hello from Bar");
}
This prints Hello from Bar
which shows Bar()
is called.
Upvotes: 4