简体   繁体   中英

Namespace constant thingy for forward slash

What's the .net namespace constant thingy for the forward slash "/"

So instead of:

somePath + "/" + someFile

I can do:

somePath + .net.namespace.forwardslash + someFile

Not really much difference but maybe neater?

System.IO.Path.DirectorySeparatorChar is what you want i think.

BTW, a saner way to do it is to use System.IO.Path.Combine(somePath,someFile) .

你应该使用System.IO.Path.DirectorySeparatorChar

如果这是您需要的,只需使用正斜杠,但如果您尝试组合文件名和路径,只需使用System.IO.Path.Combine()。

Forward Slash实际上是AltDirectorySeparatorChar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM