每次调用时调用一个方法
这可以是一个调试/监控过程。
我想知道一种方法,最好是最好的方法 每次调用一个方法类/命名空间/应用程序中的其他方法 被处决。
代码片段、意见和文章将不胜感激。
This can be a debugging/monitoring process.
I want to know a way, preferably the best way, of
calling a method every time other methods in a class/namespace/application
are executed.
Code snippets, opinions and articles would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
面向对象操作;例如,PostSharp 就提供这种类型的编织。请注意,此方法通过在构建过程中更改 IL 来工作,如果过度使用,可能会影响运行时性能。
AOP; look at PostSharp, for example, which offers this type of weaving. Note that this approach works by chaning the IL during the build process, and may impact runtime performance if over-used.
看一下面向方面编程(AOP)。一个很好的库是 Postsharp。
Take a look at Aspect Oriented Programming(AOP). A good library for this is Postsharp.