Lambda expression question
Posted: Thu Mar 15, 2018 11:03 am
Hi all,
I would like to shorten this code to something like this:
Is that possible? If yes, how?
Regards,
Stefan
Code: Select all
ASYNC METHOD btnInstallServiceClick(sender AS Object , e AS EventArgs) AS VOID
SELF:obtnInstallService:Enabled := FALSE
AWAIT Task.Run(Action{ SELF , @InstallService() })
RETURN
PROTECT METHOD InstallService() AS VOID
VAR helper := Helper{}
helper:Install()
SELF:CheckButtons()
RETURN
Code: Select all
ASYNC METHOD btnInstallServiceClick(sender AS Object , e AS EventArgs) AS VOID
SELF:obtnInstallService:Enabled := FALSE
AWAIT Task.Run( { () => VAR helper := Helper{}; helper:Install(); SELF:CheckButtons() } )
RETURN
Regards,
Stefan