什么是一个普通字符串和逐字字符串之间的区别? [英] What is the difference between a regular string and a verbatim string?
本文介绍了什么是一个普通字符串和逐字字符串之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有ReSharper的试用版,它总是建议我改用普通字符串逐字字符串。有什么区别?
I have a trial version of Resharper and it always suggests that I switch regular strings to verbatim strings. What is the difference?
推荐答案
一个逐字字符串是一个不需要进行转义,如文件名:
A verbatim string is one that does not need to be escaped, like a filename:
字符串MyFileName的=C:\\\\ \\\\ MyFolder文件myfile.txt的;
是
字符串MyFileName的= @C:\\ MyFolder文件\\ myfile.txt的;
@符号意味着从字面上看是字符串,否则不跨preT控制字符。
The @ symbol means to read that string literally, and don't interpret control characters otherwise.
这篇关于什么是一个普通字符串和逐字字符串之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文