Event Handler performance
问题 I have a performance problem. I create 100 new buttons and I want to assign an Click Event Handler. I execute this code for about 100 times: Buttons[i].Button.Click += new System.EventHandler(Button_Click); It takes about 2sec to complete. I have a lot of other event assignments in the same function, but they all take only some millisecond to execute. So I have transformed my code in Buttons[i].Button.MouseUp += new System.Windows.Forms.MouseEventHandler(Button_Click); Now the code is fast