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

From the Immediate Window in Visual Studio:

> Path.Combine(@"C:\x", "y")
"C:\\x\\y"
> Path.Combine(@"C:\x", @"\y")
"\\y"

It seems that they should both be the same.

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

16 Answers
16

Leave a Comment