简体   繁体   English

正斜杠的命名空间常量

[英]Namespace constant thingy for forward slash

What's the .net namespace constant thingy for the forward slash "/" 什么是正斜杠“/”的.net名称空间常量

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. System.IO.Path.DirectorySeparatorChar是你想要的。

BTW, a saner way to do it is to use System.IO.Path.Combine(somePath,someFile) . 顺便说一句,更好的方法是使用System.IO.Path.Combine(somePath,someFile)

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

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

Forward Slash实际上是AltDirectorySeparatorChar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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