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.
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.
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.
Take a look at Aspect Oriented Programming(AOP). A good library for this is Postsharp.