Consider this rather simple method:
private bool ValidateKey(HttpRequestMessage message)
{
}
The above method is called as follows
if (!ValidateKey(request))
{
//do something
}
Now I want to call a method inside ValidateKey which returns Task. Let's assume it is the ReadAsStringAsync method in HttpRequestMessage:
message.Content.ReadAsStringAsync();
Now since this method can run asynchronously I should ideally call it like this:
string output = await message.Content.ReadAsStringAsync();
But this will require me to change my method signature to include async and the return type to Task and then the caller too... ad infinitum.
It is possible to call ReadAsStringAsync synchronously, i.e, I am willing to have ValidateKey wait till ReadAsStringAsync completes. This will save me the trouble of changing the code just to cater to this one method.