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
Post a Comment