title: C# - Unhandled Exception - Illegal Characters in Path
body: <p>I am just testing some code at the moment, although when calling the StartRemoveDuplicate (when its compiled) an Exception is thrown, complaining about illegal characters:</p>
  
  <p><img src="https://i.stack.imgur.com/ACPyq.png" alt="error"></p>
  
  <p>My code is as follows:</p>
  
  <pre><code> class Program
      {
          static void Main(string[] args)
          {
              foreach (string exename in System.IO.File.ReadAllLines("test.txt"))
              {
                  Process.Start("test.exe", "\"" + exename + "\"").WaitForExit();
              }
  
              StartRemoveDuplicate();
  
          }
  
  
  
          private static void RemoveDuplicate(string sourceFilePath, string destinationFilePath)
          {
              var readLines = File.ReadAllLines(sourceFilePath, Encoding.Default);
  
              File.WriteAllLines(destinationFilePath, readLines.Distinct().ToArray(), Encoding.Default);
          }
  
  
          private static void StartRemoveDuplicate()
          {
              RemoveDuplicate("C:\test.txt", "C:\test2.txt");
          }
  
      }
  </code></pre>