Die-variants/event-example/dieApp.cs - A client of die that reports 'two sixes in a row' via an event. | Lecture 6 - slide 14 : 20 Program 2 |
using System; class diceApp { public static void Main(){ Die d1 = new Die(); d1.twoSixesInARow += delegate (string mes){ Console.WriteLine(mes); }; for(int i = 1; i < 100; i++){ d1.Toss(); Console.WriteLine("{0}: {1}", i, d1.NumberOfEyes); } } }