C#char"//"路径分隔符

Cat*_*ine 14 c# separator

是否有可能使用char"//"我做了另一个?我在Path寻找,但我找不到它.

  string separator = "//";
Run Code Online (Sandbox Code Playgroud)

我的意思是 '/'.

我用了:

static string sep = System.IO.Path.PathSeparator.ToString();
Run Code Online (Sandbox Code Playgroud)

但它返回:';'.为什么?

Erg*_*wun 41

Path.DirectorySeparatorChar为您提供用于分隔路径中目录的字符,即您路径中使用它.

Path.PathSeparator为您提供用于分隔环境变量中的路径的字符,即您路径之间使用它.

例如,系统的PATH环境变量通常会列出操作系统将查找应用程序运行的多个路径.

在Windows Path.PathSeparator;,并且Path.DirectorySeparatorChar\,两个路径将存储在这样的环境变量中:

set PATH="C:\first\path;C:\second\path"
Run Code Online (Sandbox Code Playgroud)


Bra*_*tie 17

System.IO.Path.PathSeparator你寻找热塑成型什么?还有.DirectorySeparatorChar其他人.请参阅"字段"下的System.IO.Path类.