[MonoDevelop] Best way to find the current directory
    Robert Jordan 
    robertj at gmx.net
       
    Wed Apr  7 09:46:25 EDT 2010
    
    
  
On 07.04.2010 15:34, Steve Ricketts wrote:
>
> I'm using the following to find the current directory and any command line
> arguments.
>
> foreach (string arg in Environment.GetCommandLineArgs())
>
>              {
>
>                  CommandLine = CommandLine + arg + " ";
>
>              }
>
> Is there a better way to get the current (executable) directory within C#?
The path of the current executable:
using System;
using System.IO;
using System.Reflection:
Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)
Current directory:
Directory.GetCurrentDirectory()
Environment.CurrentDirectory
Robert
    
    
More information about the Monodevelop-list
mailing list