var actual = Path.Combine("c:", "filename");
var expected = @"c:\filename";
Assert.AreEqual(expected, actual);
Result
{Assert.AreEqual failed. Expected:<c:\filename>. Actual:<c:filename>.
Why?
var actual = Path.Combine("c:", "filename");
var expected = @"c:\filename";
Assert.AreEqual(expected, actual);
Result
{Assert.AreEqual failed. Expected:<c:\filename>. Actual:<c:filename>.
Why?
C:filename
is a valid path and is different fromC:\filename
.C:filename
is the filefilename
in the current directory on theC:
drive whereasC:\filename
is the filefilename
in the root of that drive. Apparently they wanted to keep the functionality of refering to the current directory on some drive.This behaviour is described here in MSDN
MSDN doesn't seem to explain why, but does provide documentation on what you're seeing: