Consider the following code in a class called Worker
FileSystemWatcher watcher = new FileSystemWatcher();
public void Run()
{
watcher.Path = @"c:\queue";
watcher.Created += new FileSystemEventHandler(watcher_Created);
watcher.EnableRaisingEvents = true;
}
Now here's what I would like to do wih the Worker, but obviouly this doesn't fly.
Worker worker = new Worker();
Thread thread = new Thread(worker.Run);
thread.Start();
Console.ReadLine(); // something else more interesting would go here.
The reason being that the Run method ends rather than going into some sort of event loop. How do I get an event loop going. (I think I"m looking for something like Application.Run)