Thank, but this is not what I'm asking for.
I want to implement Trace attribute that each method that will decorate with this attribute will be traced in and trace out on runtime.
The way that I found is to use ContextBoundObject and ContextAttribute (For more details, see: http://msdn.microsoft.com/msdnmag/issues/02/03/AOP/default.aspx)
The main problems in this way, is that I'm enforced to inherit my class from ContextBoundObject and also there are performance issue using ContextBoundObject.
I want it to be more elegant and decoupled. I want my code to be like the following:
Assembly A:
class TraceAttribute: Attribute
{
}
Assembly B:
class MyClass
{
[Trace]
void f()
{
}
}
The Trace attribute will cause some action when enter to the function f() and when exit from the function. (injection or any other way)