【发布时间】:2009-01-12 18:42:44
【问题描述】:
在 WinApp 中,我只是想从 Uri 对象中获取绝对路径:
Uri myUri = new Uri(myPath); //myPath is a string
//somewhere else in the code
string path = myUri.AbsolutePath;
如果我的原始路径中没有空格,这可以正常工作。如果那里有空格,则字符串会被破坏;例如 'Documents and settings' 变成 'Documents%20and%20Setting' 等等。
任何帮助将不胜感激!
编辑: LocalPath 而不是 AbsolutePath 成功了!
【问题讨论】:
-
请注意:这是编码无知的罕见表现
标签: c# .net-2.0 system.net winapp