title: Multi-threaded Event Handlers
body: <p>Here is my single-thread code :</p>
  
  <pre><code>OnStart 
  {
   FileSystemWatcher Watcher = new FileSystemWatcher();
   Watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite |NotifyFilters.CreationTime | NotifyFilters.DirectoryName;
   FileActionHandler ActionHandler = new FileActionHandler();
   Watcher.Created += new FileSystemEventHandler(ActionHandler.onCreate);
  }
  
  onCreate(object source,FileSystemEventArgs e)
  {
   try
   {
   FileInfo file = new FileInfo (e.FullPath);
   String output = &lt;FileName&gt;File.Name + &lt;FullPath&gt;File.FullName + &lt;FileSize&gt;File.Length +  &lt;CreationTime&gt;File.CreationTime + &lt;LastAccess&gt;File.LastAccess + &lt;LastWriteTime&gt;File.LastWriteTime;
   LogToTextFile(output);
   }
   catch
   {
   LogToTextFile(ex.GetBaseException().Message);
   }
  }
  
  private void LogToTextFile(String s)
  {
  FileStream fileStream = new FileStream(@"c:\Log.txt", FileMode.Append, FileAccess.Write);
  StreamWriter sw = new StreamWriter(fileStream);
  sw.WriteLine(s);
  sw.Flush();
  sw.Close();
  fileStream.Close();
  }
  </code></pre>
  
  <p>Question: I want to incorporate Multi-Threading for Event-Handling in C# ? <code>Simply,what I mean is to start a new thread to handle for each of the events raised.</code>
   How do I go about doing that ? Please help me on this pressing issue...</p>