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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -