Missing something when writing to a Text File
<p>I simply want to be able to log the path of certain files to a text file.
I have the following to do the logging.</p>

<pre><code>static void LogFile(string lockedFilePath)
    {
        Assembly ass = Assembly.GetExecutingAssembly();
        string workingFolder = System.IO.Path.GetDirectoryName(ass.Location);
        string LogFile = System.IO.Path.Combine(workingFolder, "logFiles.txt");

        if (!System.IO.File.Exists(LogFile))
        {
            using (System.IO.FileStream fs = System.IO.File.Create(LogFile))
            {
                using (System.IO.StreamWriter sw = new StreamWriter(fs))
                {
                    sw.WriteLine(lockedFilePath);   
                }
            }
        }
        else
        {
            using (System.IO.FileStream fs = System.IO.File.OpenWrite(LogFile))
            {
                using (System.IO.StreamWriter sw = new StreamWriter(fs))
                {
                    sw.WriteLine(lockedFilePath);
                }
            }
        }
    }
</code></pre>

<p>but If I call it in a Console App like this </p>

<pre><code>foreach (string f in System.IO.Directory.GetFiles(@"C:\AASource"))
            {
                Console.WriteLine("Logging : " + f);
                LogFile(f);
            }
            Console.ReadLine();
</code></pre>

<p>The only file that is listed in the resulting text file is the last file in the dir.
What am I doing wrong?</p>
