c# get path of current directory code example
Example 1: c# get current directory
string currentDir = System.IO.Directory.GetCurrentDirectory();
//returns the current directory of the application when executing
Example 2: get directory name of path c#
string filename = @"C:/folder1/folder2/file.txt";
string FolderName = new DirectoryInfo(System.IO.Path.GetDirectoryName(filename)).Name;