public void DoCount() { IncrementerEventArgs args = new IncrementerEventArgs(); for (int i = 1; i < 100; i++) { if (i % 12 == 0 && CountedADozen != null) { args.IterationCount = i; // Raise the event CountedADozen(this, args); } } }
void IncremenDozensCount(object source, IncrementerEventArgs e) { Console.WriteLine("Incremented at iteration: {0} in {1}", e.IterationCount, source.ToString()); DozensCount++; }