Why Does Path.Combine not properly concatenate filenames that start with Path.DirectorySeparatorChar

Posted by Kris Erickson on Stack Overflow See other posts from Stack Overflow or by Kris Erickson
Published on 2008-09-09T23:05:06Z Indexed on 2010/04/21 20:23 UTC
Read the original article Hit count: 321

Filed under:
|
|

In the Immediate Window

? System.IO.Path.Combine(@"C:\test",@"test")
"C:\\test\\test"
? System.IO.Path.Combine(@"C:\test",@"\test")
"\\test"

It seems that they should both be the same.

The old FileSystemObject.BuildPath() didn't work this way...

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET