vb.net - retrieve int value from async task -


i have async task in separate project need call project im not sure how accomplish that.

the async method is

 public async task<int> insertnewpasswordresetrequest(userpasswordreset upr)     {          string commandtext = "insert passwordresetrequests (reset_username, resettoken, resetrequesttime, resetrequesttimeout) values(@username,@rt,@rrt,@rrtout);";         var parameters = new dictionary<string, object>() {           { "@username", upr.resetusername },           { "@rt", upr.resettoken },           { "@rrt", upr.resetrequesttime },           { "@rrtout", upr.resetrequesttimeout }         };          return await task.fromresult( _database.execute(commandtext, parameters, false));      } 

i trying call project so

 dim success integer = prr.insertnewpasswordresetrequest(upr).fromresult() 

i know returning task how extract int value it?

you can await of task if want run async

dim success integer = await prr.insertnewpasswordresetrequest(upr) 

or run task synchronously as

dim success integer = prr.insertnewpasswordresetrequest(upr).result 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -