static void Main(string[] args) { Incrementer incrementer = new Incrementer(); Dozens dozenCounter = new Dozens(incrementer); incrementer.DoCount(); Console.WriteLine("number of dozen = {0}", dozenCounter.DozenCount); }
static void Main() { Incrementer incrementer = new Incrementer(); Dozens dozensCounter = new Dozens(incrementer); incrementer.DoCount(); Console.WriteLine("Number of dozens = {0}", dozensCounter.DozensCount); }
static void Main() { var incrementer = new Incrementer(); Dozens dozensCounter = new Dozens(incrementer); incrementer.DoCount(); Console.WriteLine(dozensCounter.DozensCount); }
public void _01() { var incrementer = new Incrementer(); var dozens = new Dozens(incrementer); incrementer.DoCount(); Assert.Equal(9, dozens.DozensCount); }
static void Main(string[] args) { Incrementer incrementer = new Incrementer(); // สร้าง publisher Dozens dozenCounter = new Dozens(incrementer); // สร้าง subscriber โดยระบุ publisher เป็น parameter incrementer.DoCount(); // จำลองสถานการณ์ที่ firing event Console.WriteLine("number of dozen = {0}", dozenCounter.DozenCount); // รายงานสรุป }
public void _01() { var incrementer = new Incrementer(); incrementer.CountedADozen += (_, incrementerEventArgs) => { testOutputHelper.WriteLine(incrementerEventArgs.IterationCount.ToString()); }; incrementer.DoCount(); }
public void demo3() { Incrementer incrementer = new Incrementer(); //Dozens dozensCounter = new Dozens(incrementer); Dozens dozensCounter = new Dozens(); incrementer.CoutedADozen += dozensCounter.IncrementDozensCount; incrementer.DoCount(); Console.WriteLine("dozensCount:{0}", dozensCounter.DozensCount); }
static void Main() { Incrementer incrementer = new Incrementer(); // instantiate Publisher Dozens dozensCounter = new Dozens(incrementer); // instantiate Subscriber incrementer.DoCount(); // invoke method in Publisher, which will raise event. Console.WriteLine("Number of dozens = {0}", dozensCounter.DozensCount); Console.ReadLine(); }