且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

@前缀对C#中的字符串文字有何作用

更新时间:2023-02-25 14:04:52

@与任何方法都不相关.

@ is not related to any method.

这意味着您无需在符号后的字符串中转义特殊字符:

It means that you don't need to escape special characters in the string following to the symbol:

@"c:\temp"

等于

"c:\\temp"

这种字符串称为'verbatim'或@引号.请参见 MSDN .

Such string is called 'verbatim' or @-quoted. See MSDN.