开发者

ASP.net: Code explanation of delegates and events

Given this code:

WriteThisMessageToThePage1.sendMessageToThePage += delegate(string message)

Can anyone explain me what this line means in delagates? W开发者_StackOverflow中文版hat does this code represent?


+= is a short hand notation for subscribing to an event. The delegate(string message) code represents the event handler for the event. In this case the event handler is an anonymous method. When the sendMessageToThePage event fires, the code next += is executed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜