属性的使用案例

Action<int> Open;
protected virtual void OnOpen()
{
   if(this.Open!=null)
     this.Open();
}

int scoutValue;

public Int ScoutValue
{
  get{return this.scoutValue;}
  set{
      this.scoutValue=value;
      if(this.scoutValue<100)
         this.OnOpen();
      }
}
//
因为事件是一个域所以可以额外的添加一些其它的"语句",这当然可以包括是去触发一个
事件.

posted @ 2013-06-15 09:23  sovf  阅读(135)  评论(0编辑  收藏  举报