每次调用时调用一个方法

发布于 2024-12-19 03:19:02 字数 154 浏览 2 评论 0原文

这可以是一个调试/监控过程。

我想知道一种方法,最好是最好的方法 每次调用一个方法类/命名空间/应用程序中的其他方法 被处决。

代码片段、意见和文章将不胜感激。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

金兰素衣 2024-12-26 03:19:02

面向对象操作;例如,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.

逐鹿 2024-12-26 03:19:02

看一下面向方面编程(AOP)。一个很好的库是 Postsharp

Take a look at Aspect Oriented Programming(AOP). A good library for this is Postsharp.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文