Please explain Timer event async/await syntax

后端 未结 3 2145
时光取名叫无心
时光取名叫无心 2020-12-18 09:04

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 understa

3条回答
  •  一个人的身影
    2020-12-18 09:31

    This is just an asynchronous lambda expression. It's equivalent to:

    timer.Elapsed = CallHandleTimer;
    
    async void CallHandleTimer(object sender, EventArgs e)
    {
        await HandleTimer();
    }
    

提交回复
热议问题