Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
315 views
in Technique[技术] by (71.8m points)

c# - Should I Create a New Delegate Instance?

What are the implications of doing this...

this.myButton.Click += new EventHandler(this.myButton_Clicked);

...versus this?

this.myButton.Click += this.myButton_Clicked;

I suspect that the compiler is creating a new instance for me in the second example. I'm sure this is a bit of a newbie question, but Google didn't turn up anything. Can anyone give me some insight?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...