c# - Implicit awaiting? -


i have method create :

public async task<myobject> create(string str1, string str2) {     // check see if myobject can created in database.     if (!await cancreate(str1, str2))     {         return null;     }      // create object.     var myobj = new myobject     {         created = datetime.now.date,         first = str1,         second = str2     };      // log event.     _loggingservice.log(myobj, logtype.created);      // return created myobject.     return _repository.createasync(myobj)); } 

the method cancreate(string, string) returns task<bool>.

the method log(myobject, logtype) returns task.

the method createasync(myobject) returns task<myobject>.


notice cancreate awaited while both log , createasync not. question then, in example, when create returns , awaited so:

 var result = await _service.create("abc", "def"); 

is log awaited await call on create?

is log awaited await call on create?

no, isn't. log pass through , encapsulated task produces ignored (along exception propagates). because end returning task createasync, awaited.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -