c# - Is it necessary to await a single asynchronous call -
this question has answer here:
if i'm returning result of single asynchronous function e.g. in service between application layers, there difference between:
public task<byte[]> getinsurancepolicydocument(string itineraryreference) { return this.coreitinerarydocumentservice.getinsurancepolicydocument(itineraryreference); }
and:
public async task<byte[]> getinsurancepolicydocument(string itineraryreference) { return await this.coreitinerarydocumentservice.getinsurancepolicydocument(itineraryreference); }
there few subtle differences in cases - example, if original task
returns status of faulted
operationcanceledexception
async
version return task status of canceled
... unless need of subtlety, better go first code , avoid (very slight) overhead of wrapping it.
Comments
Post a Comment