Question
FileInfo behaves differently on .NET 2 and .NET 4.8
I have converted a legacy application from .NET 2 to .NET 4.8 and found that the FileInfo
API behaves differently on the 2 platforms.
.NET 2:
new FileInfo("C:\a \b").FullName -> "C:\a\b"
.NET 4.8:
new FileInfo("C:\a \b").FullName -> "C:\a \b"
I am wondering if there is any configuration that I can set in app.config
/web.config
to make .NET 4.8 behave similar to .NET 2.0?
BTW I also find that on both .NET versions, Directory.CreateDirectory
will always ignore the spaces at the end such that Directory.CreateDirectory("C:\a ")
will create the folder C:\a
.
Could anyone please point me to the corresponding reference of this behavior?