using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime;
using System.Runtime.CompilerServices;
using System.Security;
using System.Text;
using System.Threading;
public class MainClass
{
public static void Main()
{
using (Timer t = new Timer(TimerWorker, "Testing", 0, 50))
{
Thread.Sleep(500);
Console.WriteLine("Shutting down timer...");
}
}
private static void TimerWorker(object state)
{
Console.WriteLine("Timer event! {0}", state);
}
}
Timer event! Testing
Timer event! Testing
Timer event! Testing
Timer event! Testing
Timer event! Testing
Timer event! Testing
Timer event! Testing
Timer event! Testing
Shutting down timer...
Timer event! Testing