SharpRush中的AOP实现
//aspect code:
    [AttributeUsage(AttributeTargets.Class)]
 public class SecurityAspectAttribute:AOPAttribute
 {
  public SecurityAspectAttribute()
  {
  }
  public override void PreProcess(System.Runtime.Remoting.Messaging.IMessage msg)
  {
   System.Windows.Forms.MessageBox.Show("pre");
  }
  public override void PostProcess(System.Runtime.Remoting.Messaging.IMessage msg)
  {
   System.Windows.Forms.MessageBox.Show("post");
  }
 }
 
 //client code:
 [SecurityAspect]
 public class Class1:AOPObject
 {
  public Class1()
  {
  }
  public void test()
  {
   System.Windows.Forms.MessageBox.Show("test");
  }
 }
                    
                
 
  
                
            
        
浙公网安备 33010602011771号