<分区>
Possible Duplicate:
What's the @ in front of a string in C#?
为什么我们使用 @
将 \
替换为另一个字符串,使用 string.replace(@"\","$$")
我正在使用 C#
Windows 应用程序
<分区>
Possible Duplicate:
What's the @ in front of a string in C#?
为什么我们使用 @
将 \
替换为另一个字符串,使用 string.replace(@"\","$$")
我正在使用 C#
Windows 应用程序
最佳答案
字符串文字前面的 @
使其成为 verbatim string literal , 所以反斜杠 \
不需要加倍。您可以使用 "\\"
而不是 @"\"
来达到相同的效果。
关于c# - 为什么我们在尝试用另一个字符串替换它时将 @ 与 "\"一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12249437/