title: C# find directory arg in commandline
body: <p>I'm new to C# and trying to find the directory arg in commandline. For example, if I type</p>
  <p><em>dotnet run -- -f c:\example\exampleFolder -v OR dotnet run -- -f -v c:\example\exampleFolder</em></p>
  <p>It should detect <strong>exampleFolder</strong> directory no matter which arg position it is at and set it to the current working directory.
  So far, I have this in my Main method...</p>
  <pre><code>foreach(var path in args)
  {
      FileAttribute attr = File.GettAttributes.Directory(path);
      if ((attr &amp; FileAttributes.Directory) == FileAttributes.Directory)
      {
          //
          // Directory.SetCurrentDirectory();
      }
  }
  </code></pre>