c# 4.0 - Can we split the Filepath from the last folder in C#? -
for example have file isample.cs in path
"d:\test_source\cv\source code\army.data\proceduresall\isample.cs"
here wanna file-path
"proceduresall\isample.cs"
before don't wanna path.here using folder browser choosing folder.
please me regarding this.
you mean this?
string path = @"d:\test_source\cv\source code\army.data\proceduresall\isample.cs"; //isample.cs path.getfilename(path); //d:\test_source\cv\source code\army.data\proceduresall path.getdirectoryname(path); //proceduresall path.getdirectoryname(path).split(path.directoryseparatorchar).last();
use path.combine("proceduresall", "isample.cs") proceduresall\isample.cs (using above these strings).
Comments
Post a Comment