using System;
met System.Timers;
namespace evnt1
{
class Class1
{
static int count = 0;
statische reeks dispstrg = "Hoe gaat het",
public static void Main ()
{
Timer mt = new Timer (100);
mt.Elapsed + = new ElapsedEventHandler (mt_Elapsed);
mt.Start ();
Console.ReadLine ();
methode m = nieuwe methode ();
m.mt1.Elapsed + = new ElapsedEventHandler (m.show );
m.mt1.Start ();
Console.ReadLine ();
}
private static void mt_Elapsed (object afzender, ElapsedEventArgs e)
{
als (aantal Console.
Write (dispstrg [count ++% dispstrg.Length]);
}
}
< p> public class methode
{
openbare Timer mt1 = new Timer (250);
public void voorstelling (object afzender, ElapsedEventArgs e)
{
Console.WriteLine ("Vindt u dat grappig");
mt1.Stop ();
}
}
< p>}