Path.GetDirectoryName() namespace code example
Example: get directory of file c#
using System.IO;
string file = "C:\Documents\file.txt";
Path.GetDirectoryName(file);
using System.IO;
string file = "C:\Documents\file.txt";
Path.GetDirectoryName(file);