开发者

Internal working of delegates in C# [duplicate]

This question already ha开发者_StackOverflow社区s answers here: Closed 11 years ago.

Possible Duplicate:

How delegates work (in the background)?

As we know delegate is function pointer.

How it is working internally?

Detailed explanation will be appreciated.


The following article on MSDN presents a nice overview of delegates in .NET and how they work internally.


Whilst I'm sure someone will come up with a good literal explanation for this, I'd recommend reading the following book which covers everything nicely:

http://www.amazon.com/dp/0735627045/ (CLR via C#, Jeffrey Richter).


Delegates (1) in C# are lists of method pointers. I.e. they store references to code, and you can invoke the methods via the pointers. This is useful in many cases. The common example is for event handlers where delegates are used to implement a publisher/subscriber pattern.

(1)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜