开发者

string s= @"somet"hing" what is wrong about this?

开发者 https://www.devze.com 2023-01-04 08:51 出处:网络
I expected that there is no something wrong but VS2010 gives error. s开发者_如何学运维tring s= @\"somet\"hing\";You need to double-up quotation marks within an @ string.

I expected that there is no something wrong but VS2010 gives error.

s开发者_如何学运维tring s= @"somet"hing";


You need to double-up quotation marks within an @ string.

string s = @"somet""hing";

Otherwise how would it know which quotes were escapes and which were the end markers?

Refer to the MSDN string page.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号