C# Directory GetCurrentDirectory
Description
Directory GetCurrentDirectory
Gets the current working
directory of the application.
Syntax
Directory.GetCurrentDirectory
has the following syntax.
public static string GetCurrentDirectory()
Returns
Directory.GetCurrentDirectory
method returns A string that contains the path of the current working directory, and does
not end with a backslash (\).
Example
The following example demonstrates how to use the GetCurrentDirectory method.
/*from www . j av a 2s . c o m*/
using System;
using System.IO;
class Test
{
public static void Main()
{
string path = Directory.GetCurrentDirectory();
Console.WriteLine("The current directory is {0}", path);
}
}
The code above generates the following result.