I have a path like
string path = @"C:\foo\bar\temp\test\file.txt";
and want to get the foldername of the file - in this case the expected result is "test"
.
Is there a build in way which is more elegant compared to path.SubString(path.LastIndexOf('/')
etc..