BackgroundWorker with anonymous methods?

前端 未结 4 1393
猫巷女王i
猫巷女王i 2021-02-05 03:55

I\'m gonna create a BackgroundWorker with an anonymous method.
I\'ve written the following code :

BackgroundWorker bgw = new B         


        
4条回答
  •  迷失自我
    2021-02-05 04:09

    You just need to add parameters to the anonymous function:

    bgw.DoWork += (sender, e) => { ... }
    

    Or if you don't care about the parameters you can just:

    bgw.DoWork += delegate { ... }
    

提交回复
热议问题