Delegate vs. delegate keyword

前端 未结 6 2070
长情又很酷
长情又很酷 2020-12-13 03:51

If you like to create custom delegates you would use the delegate keyword in lowercase.

What can you do with the actual Delegate Class? Wh

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 04:30

    Another neat thing you can do with delegate keyword is create delegates inline, without having to declare them, for example:

    // constructor
    public Form1()
    {
        this.Load += delegate(object sender, EventArgs e)
        {
             // Form1_Load code goes right here
        }
    }
    

提交回复
热议问题