How to terminate a console mode app from a BackGroundWorker
<p>I am creating one BackgroundWorker and inside its DoWork function I have the following code:  </p>

<pre><code>        foreach (string newFilepath in newFilesPath)
        {
                        if (!File.Exists(encryptedFilePath))
                        {
                            encryptedFiles.Add(encryptedFilePath);
                            Helper.SendErrorMail(null, "Could not find encrypted file.", encryptedFilePath);
                            Application.Exit();
                        }
                        else
                        {
                            Helper.Count_DataFeeds++;
                            File.Delete(newFilepath);
                        }
        }
</code></pre>

<p>As per this code I should see only one mail because the Application exists, however I am seeing 8 mails(for each file it is iterating).  Why application is not quitting ? I want to kill the application at once.</p>

<p>It is a console application.</p>
