Can you guess how many times will this console application output the current date?
class Program
{
private static Tubo tubo = new Tubo();
static void Main(string[] args)
{
One();
tubo.RaiseTubek();
Console.WriteLine("Finished");
Console.ReadLine();
}
private static void One()
{
tubo.Tubek += delegate { Console.WriteLine(DateTime.Now); };
tubo.RaiseTubek();
}
}
public class Tubo
{
public event EventHandler Tubek;
public void RaiseTubek()
{
if (Tubek != null)
Tubek(this, EventArgs.Empty);
}
}