0

I have some path string which are too long to handle via FileInfo. So I am prepending the pathstring with @"\?\" because I read (for example in one the answers (unfortunately linkonly) in How can I use FileInfo class, avoiding PathTooLongException? that this string would help with large pathnames (by forcing .NET to use Unicode mode which has a much higher limit than 260 or so)

But as soon as I use the whole string with the "long string"-identifier with the FileInfo class I get an error saying "Illegal char in path".

Am I missing something on how I can use this workaround?

Specific example:

fileInformations.FileLastChanged = File.GetLastWriteTime(_path); 
//this line causes the error.
Community
  • 1
  • 1
Snickbrack
  • 1,253
  • 4
  • 21
  • 56

0 Answers0