属性的使用案例

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();
      }
}
//
因为事件是一个域所以可以额外的添加一些其它的"语句",这当然可以包括是去触发一个
事件.

原文地址:https://www.cnblogs.com/sovf/p/3137181.html