c# - Is it necessary to await a single asynchronous call -


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

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -