Cross-platform file name handling in .NET Core

前端 未结 6 1439
我在风中等你
我在风中等你 2020-12-15 03:02

How to handle file name in System.IO classes in a cross-platform manner to make it work on Windows and Linux?

For example, I write this code that works

6条回答
  •  别那么骄傲
    2020-12-15 03:44

    You can simply use slashes. Relative paths will work identically, and absolute paths can only be relative to the root of the main drive (as absolute paths starting with "c:" are not portable)

提交回复
热议问题