如何在C#中创建名称包含特殊字符的文件 [英] How do i create a file in c# which name include a special character

查看:201
本文介绍了如何在C#中创建名称包含特殊字符的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在c#中创建一个包含特殊字符的文件(在我的情况下为/)

例如,我想从水晶报表生成名称为WB074/A504

How do i create a file in c# which name include a special character (in my case it''s /)

for example I want to generate a pdf file from crystal report with name WB074/A504

推荐答案

的pdf文件.

使用当前代码页中的任何字符作为名称,包括Unicode字符和扩展字符集(128-255)中的字符,以下内容除外:

< (少于)
> (大于)
:(冒号)
(双引号)
/(正斜杠)
\(反斜杠)
| (垂直杆或管)
? (问号)
*(星号)

来源
http://msdn.microsoft.com/en -us/library/windows/desktop/aa365247(v = vs.85).aspx#naming_conventions [
You can''t.

Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128 - 255), except for the following:

< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
\ (backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)

Source
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#naming_conventions[^]

Cheers


您不能在文件名中使用以下字符,因为Windows不允许使用,它们具有特殊含义:

\/| :*?<>
You cannot use the following characters in file names as Windows will not allow it and they have special meanings :

\ / | : * " ? < >


这篇关于如何在C#中创建名称包含特殊字符的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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