例外:" URI格式不支持" [英] Exception: "URI formats are not supported"

查看:370
本文介绍了例外:" URI格式不支持"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有绝对的本地路径指向一个方向:文件:\\ C:\\用户\\ \\约翰文档\\的Visual Studio 2010 \\ \\项目PROJ

但是,当我试图把它扔进的DirectoryInfo 的构造函数,我得到了URI格式不支持异常。

我一派,看着如此,但是我只看到远程路径,而不是本地的解决方案。我期望某种形式的转换方法...

解决方案

 字符串uriPath =
    文件:\\ C:\\用户\\ \\约翰文档\\的Visual Studio 2010 \\ \\项目PROJ;
串了localPath =新的URI(uriPath).LocalPath;
 

I have an absolute local path pointing to a dir: "file:\\C:\\Users\\john\\documents\\visual studio 2010\\Projects\\proj"

But when I try to throw it into DirectoryInfo's ctor I get the "URI formats are not supported" exception.

I googled and looked on SO, but I only see solutions with remote paths, not local ones. I'd expect a conversion method of some sort...

解决方案

string uriPath =
    "file:\\C:\\Users\\john\\documents\\visual studio 2010\\Projects\\proj";
string localPath = new Uri(uriPath).LocalPath;

这篇关于例外:" URI格式不支持"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆