this is done easily by splitting the string to get the folder name. string []folders=inputPath.Split('\\',StringSplitOptions.RemoveEmptyEntries); to get the last folder do this: string lastFolder=folders[folders.Length-1];
and conanlive'., why do yu' use the verbatim string literal & adding a escape sequence for backslash...!?? just a singe backslash will do in verbatim..., right..!??
ya since you are adding @ before the string there is no need to write \\ since the escape character won't be effective in the string so you can remove the @ or replace \\ with a single \. In both ways the code written above will work.
hy3 muster., one second'., but iF we are using' verbatim & also a \\ inside'., then for ex., if yu'r <b>opening</b> the file in string inputpath as mentioned above., it'll be a error.., throwing, address cannot be found., right..!??
1 answers
this is done easily by splitting the string to get the folder name.
string []folders=inputPath.Split('\\',StringSplitOptions.RemoveEmptyEntries);
to get the last folder do this:
string lastFolder=folders[folders.Length-1];
answered 9 months ago by:
1441
and conanlive'., why do yu' use the verbatim string literal & adding a escape sequence for backslash...!??
just a singe backslash will do in verbatim..., right..!??
answered 9 months ago by:
60
ya since you are adding @ before the string there is no need to write \\ since the escape character won't be effective in the string so you can remove the @ or replace \\ with a single \. In both ways the code written above will work.
answered 9 months ago by:
1441
hy3 muster., one second'.,
but iF we are using' verbatim & also a \\ inside'.,
then for ex.,
if yu'r <b>opening</b> the file in string inputpath as mentioned above., it'll be a error.., throwing, address cannot be found.,
right..!??
answered 9 months ago by:
60
This post was imported from csharpfriends, if you have a similiar question please ask it again.
All previous members have been migrated, hope you enjoy the new platform!