c# get directory in project code example
Example 1: get working directory c#
var DDIR = System.IO.Directory.GetCurrentDirectory();
var WorkingDirectory = "";
int index = DDIR.IndexOf(@"\");
if (index > 0)
WorkingDirectory = DDIR.Substring(0, index) + @"\";
Example 2: c# project path
string startupPath = System.IO.Directory.GetCurrentDirectory();
string startupPath = Environment.CurrentDirectory;
Example 3: get folders in directory c#
string[] folders = System.IO.Directory.GetDirectories(@"C:\My Sample Path\","*", System.IO.SearchOption.AllDirectories);