Reputation: 304
I want to have slash instead of backslash, because my application communicates with a ftp not allowing backslash as directory-seperator.
Is there any shortcut/configuration without writing my own method?
Upvotes: 7
Views: 3531
Reputation: 39625
Stealing @Tejs comment as an answer.
Since GetDirectoryName
returns a string, you can simply replace the backslashes with the symbol you prefer:
Path.GetDirectoryName(path).Replace("\\", "/")
Upvotes: 3