2012-03-29 47 views
2

雖然我使用ReSharper的,他總是說是什麼的MouseDown + =鼠標按下

enter image description here

是有什麼差別 「的MouseDown + =新MouseEventHandler(鼠標按下)」 和區別?

任何細節都會很好

謝謝大家。

+2

[+ = new EventHandler(Method)vs + = Method](http://stackoverflow.com/questions/2749868/new-eventhandlermethod-vs-method)或[我應該實例化一個新的委託或不?](http://stackoverflow.com/questions/4676399/should-i-instantiate-a-new-delegate-or-not)或[使用「新的EventHandler 」而不使用新的EventHandler 「 ?](http://stackoverflow.com/questions/5468868/difference-between-wiring-events-using-new-eventhandlert-and-not-using-new-e) – SwDevMan81 2012-03-29 20:23:09

+2

或[C#:區別'+ = anEvent '和'+ = new EventHandler(anEvent)'](http://stackoverflow.com/questions/550703/c-difference-between-anevent-and-new-eventhandleranevent) – SwDevMan81 2012-03-29 20:28:46

+1

bc resharper是一個臃腫的豬吃你的cpu dorritos //只有輕微的諷刺意味 – payo 2012-03-29 22:30:19

回答

7

較短的語法已在C#2.0中引入,它只是較長形式的語法糖。

不管你寫什麼,結果都是一樣的。但是,更短更可讀。

4

確實沒有區別。 「新的MouseEventHandler」部分是隱含的。

相關問題