开发者

Need Method Entry and Exit event in .net

I like to have event like OnMethodEntry and OnMethodExit which will be used to raise an event when a method in a class is getting invoked in C#.NET.

I have seen Post Sharp which give this feature. Since it is third party tool, we like to design a library something similar to that.

How can I do that?

Thank开发者_开发知识库s, P.Gopalakrishnan.


CodeProject has a nice article that I think will meet your needs: MethodLogger - Hook into method calls in .NET binaries.


One way to do this is to modify assemblies by inserting these method calls manually in the IL.


You may try Cecil or CCI. They are good and mature libraries for reading and patching assemblies.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜