Exemplo n.º 1
0
 public void Update()
 {
     //遍历订阅者对象列表进行通知
     foreach (var item in observables)
     {
         if (item != null)
         {
             TenXun tenXun = this;
             item.ReceiveAndPrint(tenXun);
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 使用订阅号对象来通知订阅者的消息
 /// </summary>
 /// <param name="tenXun"></param>
 public void ReceiveAndPrint(TenXun tenXun)
 {
     System.Console.WriteLine("Notified{0} of{1} s" + "Info is:{2}", Name, tenXun.Symbol, tenXun.Info);
 }