使用字符串c#时c#问题中的字符串? [英] string in c# problem when using string c#?

查看:64
本文介绍了使用字符串c#时c#问题中的字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


请我尝试在c#字符串中使用此字符串

我的字符串

 reg add\\10.10 .10.10\a\b_b\cc\d/ f 









请帮帮我

解决方案

所有那些斜杠/反斜杠驱动C#疯狂......

原因是 \ 转义字符 [<所有C系列语言的href =http://msdn.microsoft.com/en-us/library/h21280bw.aspxtarget =_ blanktitle =New Window> ^ ] 。

幸运的是,您可以使用 @ 来声明可以容纳此类内容的字符串文字 - http://msdn.microsoft.com/en-us/library/aa691090(v = vs.71)的.aspx [ ^ ]

将\\10.10.10.10\\\\ b_b\cc\d/ f更改为\\\\10.10.10.10 \\\\ a \\b_b\\cc\\d/ f。即使用转义序列。


Hi Please i try to use this string in c# string
My string

reg add "\\10.10.10.10\a\b_b\c c\d" /f





Please help me

解决方案

All those slash/backslash drives C# crazy...
The reason is that \ is THE escape character[^] of all the C family languages...
Fortunately you can use @ to declare string literals that can hold such content - http://msdn.microsoft.com/en-us/library/aa691090(v=vs.71).aspx[^]


change "\\10.10.10.10\a\b_b\c c\d" /f to "\\\\10.10.10.10\\a\\b_b\\c c\\d" /f. i.e. use escape sequence.


这篇关于使用字符串c#时c#问题中的字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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