2

I have some problem with PostSharp (I assume that problem can be solved by other library). I have that scenario:

I must get all classes with name containing a word, e.g "Sth". I have that classes in my project (an example):

SthClass1.cs
SthClassBlabla.cs
SthClass3.cs

and I find that classes using PostSharp:

[assembly: TraceAttribute( AttributeTargetMembers = "Sth*")]

then, is it possible to inject (using aspect, PostSharp (?)) code for each found class ?

example:

 SthClass1 myObj = new SthClass1();
 myObj.ClassMethod1();
 myObj.ClassMethod2();
 myObj.InjectedMethod(); //that method belongs to the aspect
一二三
  • 21,059
  • 11
  • 65
  • 74
Tony
  • 12,405
  • 36
  • 126
  • 226