寻找类似于 Path.Combine 的东西来导航文件夹
我的一位同事正在 System.IO 中寻找一种可以执行此操作的方法:
var path1 = "c:\\temp\\foo\\bar";
var path2 = "..\\..\\foo2\\file.txt";
var path3 = Path.Combine2(path1, path2);
// path3 = "c:\\temp\\foo2\\file.txt"
System.IO 中是否有任何内容可以进行这种类型的组合,或者他必须编写自己的方法吗?我什么也没找到。
谢谢!
A colleague of mine is looking for a method in System.IO that will do this:
var path1 = "c:\\temp\\foo\\bar";
var path2 = "..\\..\\foo2\\file.txt";
var path3 = Path.Combine2(path1, path2);
// path3 = "c:\\temp\\foo2\\file.txt"
Is there anything in System.IO to do this type of combining, or will he have to write his own method? I couldn't find anything.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这应该可以做到;
This should do it;