簡體   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