public void CountNumbers() { for (int i = 0; i <= 100; i++) { if (i == 77) { Notyfi?.Invoke(this, new EventArgs()); } } }
public void Search(List <string> s) { string pattern = "Teacher teaches"; foreach (var str in s) { if (str.Contains(pattern)) { Notyfi?.Invoke(this, new StringEventArgs(pattern)); } } }
//delegate void Notifier(Notifier notifier); public void Play(object sender, EventArgs e) { Random random = new Random(); int randomNumber = random.Next(0, 10); string s = randomNumber > 1 ? "Ping gets Pong" : "Pong missed! Ping win"; if (randomNumber > 1) { Console.WriteLine(s); Notyfi?.Invoke(this, new EventArgs()); } else { Console.WriteLine(s); } }