bruker System;
bruker System.Timers;
navnerom evnt1
{
class Class1
{
static int teller = 0;
statisk string dispstrg = "How are you";
public static void main ()
{
Timer mt = new Timer (100);
mt.Elapsed + = new ElapsedEventHandler (mt_Elapsed);
mt.Start ();
Console.ReadLine ();
metoden m = ny metode ();
m.mt1.Elapsed + = new ElapsedEventHandler (m.show );
m.mt1.Start ();
Console.
ReadLine ();
}
private static void mt_Elapsed (objekt avsenderen, ElapsedEventArgs e)
{
if (teller Console.Write (dispstrg [teller ++% dispstrg.Length]);
}
}
< p> public class metode
{
offentlig Timer MT1 = new Timer (250);
public void showet (objekt avsenderen, ElapsedEventArgs e)
{
Console.WriteLine ("Synes du at morsomt");
mt1.
Stop ();
}
}
< p>}