我在尝试引用与我的应用程序位于同一网络上的另一个驱动器\路径时遇到问题。
string LocationPath = "\\servername\F$\FirstDirectory\SecondDirectory\filename.txt";
我想使用streamreader捕获此文件的内容,但似乎无法访问它。这是我在文件资源管理器中引用目录的方式,如何在C#中完成?
感谢您的输入!
您需要转义反斜杠:
string LocationPath = "\\\\servername\\F$\\FirstDirectory\\SecondDirectory\\filename.txt";
或使用逐字字符串:
string LocationPath = @"\\servername\F$\FirstDirectory\SecondDirectory\filename.txt";
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句