简体   繁体   English

试图在 C# 中生成一个包含“@”字符的字符串

[英]trying to produce a string in C# containing “@” character

I have spent a ridiculous amount of time trying to figure out how to specify a literal string in C# that contains an "@" at symbol followed by a space (asp.net mvc 5 actually).我花了很多时间试图弄清楚如何在 C# 中指定一个文字字符串,该字符串在符号中包含一个“@”,后跟一个空格(实际上是 asp.net mvc 5)。 Searching the internet has proved fruitless in this effort.事实证明,在互联网上搜索是徒劳的。 Seems the search engines are smarter than I and already know I couldn't possibly be searching for what I asked for.似乎搜索引擎比我更聪明,并且已经知道我不可能搜索到我想要的东西。 Any help how to construct such an evil string?任何帮助如何构造这样一个邪恶的字符串? thanks.谢谢。

答案:string atSymbol = "\@";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM