[Mono-list] directory path separator

Jonathan Pryor jonpryor@vt.edu
Thu, 16 Sep 2004 20:07:38 -0400

On Thu, 2004-09-16 at 09:50, Kevin White wrote:
> In java there is the notion of using a system variable to tell you
> what the platform-specific folder separator is.  Is the same true for
> .Net?  I've only done .Net on windows and haven't cared until now.

As others have already stated, you can use

You can also use System.IO.Path.Combine(string, string), which handles
DirectorySeparatorChar transparently:

	string path1 = "foo" + Path.DirectorySeparatorChar + "bar";
	string path2 = Path.Combine ("foo", "bar");

Path.Combine() is the recommended approach, as it needs less typing. :-)

 - Jon