System.ArgumentException路径中的非法字符 [英] System.ArgumentException illegal characters in path

查看:1172
本文介绍了System.ArgumentException路径中的非法字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Path.Combine,并且其中一个字符串包含Unicode字符。我得到{System.ArgumentException}异常;路径中包含非法字符。

I am using Path.Combine, and one of the strings contain a Unicode characters. I get {System.ArgumentException} exception; illegal characters in path.

根据 MSDN 文件路径/名称可以包含Unicode字符。为什么会出现此异常?

According to MSDN filepath/name can have unicode characters. Why do I get this exception?

编辑:
这是代码:

Here is the code:

路径。 Combine( C:\PDM\Silver, Amabel Bender QQQ)

Path.Combine("C:\PDM\Silver","Amabel Bender QQQ")

推荐答案

我发现了问题所在。第二个字符串中包含一个 tab字符,导致异常。 (当我将字符串粘贴到这里时并没有出现)

I figured out the problem. The second string contains a "tab" character in it causing the exception. (that didn't showed up when I pasted the string here)

谢谢大家,对于造成的混乱感到抱歉。

Thanks everyone and sorry for the confusion.

这篇关于System.ArgumentException路径中的非法字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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