改变变量触发事件

public   delegate   void   delegateHandler();   
  public   class   Program   
  {   
        public   int   i=0;   
        public   delegateHandler   myhandle;   
        public   int   changeI   
        {   
                  get{return   i;}   
                  set{   
                          i=value;   
                          myhandle();   
                          }   
          }   
  }   
    
  public   class   otherclass   
  {   
        public   my   o;   
        public   otherclass()   
  {       o=new   my();   
  }   
  pulic   void   init()   
  {   
        o.myhandle+=new   delegateHandler(howtodeal);   
  }   
  public   void   howtodeal()   
  {   
        //你自己的处理程序 
}
原文地址:https://www.cnblogs.com/bile/p/3230362.html