I researched the asynch and await syntax here and here. It really helps to understand the usage but I found an intriguing syntax example on MSDN which I just don't understand.
Question:
Could someone please explain to me the syntax of this System.Timers.Timer
event registration with asynch await:
Why can you use the async
await
keywords already in the lambda expression?
Timer timer = new Timer(1000);
timer.Elapsed += async ( sender, e ) => await HandleTimer();
private Task HandleTimer()
{
Console.WriteLine("\nHandler not implemented..." );
}
Question 2:
And what are the two parameters sender
& e
good for if they don't appear in the HandleTimer
method?