When defining a path to a directory as a variable or constant, should it end with a trailing slash? What is the convention?
pwd
in Unix shows your curre
Whenever I store directory paths or return them from APIs, I try and stick with the convention of keeping a trailing slash. This avoids the whole 'is it a file or a directory' ambiguity.
Addendum:
This is not intended to be a substitute for using methods that can tolerate either a trailing slash or its absence. Even using this convention I still always use Path.Combine(...)
and similar methods.