繁体   English   中英

正斜杠的命名空间常量

[英]Namespace constant thingy for forward slash

什么是正斜杠“/”的.net名称空间常量

所以代替:

somePath + "/" + someFile

我可以:

somePath + .net.namespace.forwardslash + someFile

没有太大的区别,但可能更整洁?

System.IO.Path.DirectorySeparatorChar是你想要的。

顺便说一句,更好的方法是使用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