ARTICLE AD BOX
If every async method I need to return a Task and use await. Then I propagate the await to the caller, then all invoking methods have to be Async and use await?
So if I have a method:
async Task<int> GetNumberAsync() { return await GettingNumberFromHttpClient(); }Then because it returns Task I have to use await to use it? Then the method of the invoking caller will also have to return Task with await and then all methods in my code will have await, what am I missing?
then I would have to have another method like:
async Task AnotherMethodAsync() { var number = await GetNumberAsync(); var result = number + 5; }then if I have to call now AnotherMethodAsync, then I have to use await again and then the loop never ends of calling await and async...
Would it be okay to AnotherMethod to be like:
async void AnotherMethod() { var number = await GetNumberAsync(); var result = number + 5; }Now AnotherMethod has async to use await but returns void thus ending the loop of async await calls? Every place I read about this, they say you must return the Task and using void is essentially not recommended as your code might not work with try/catch etc...
