what is the meaning of “ += ( s, e )” in the code?

前端 未结 4 1065
无人及你
无人及你 2021-02-06 11:22

What is exactly the += ( s, e ) in the code?

example:

this.currentOperation.Completed += ( s, e ) => this.CurrentOperationChanged();

4条回答
  •  温柔的废话
    2021-02-06 11:52

    It is a shorthand for an event handler. s --> object sender and e --> some type of EventArgs.

    It can also be rewrriten as:

    public void HandlerFunction(object sender, EventArgs e)
    {
       this.loaded = true;
    }
    

提交回复
热议问题