Escape @ character in razor view engine

I am creating a sample ASP.NET MVC 3 site using Razor as view engine. The razor syntax starts with @ character eg @RenderBody() . If I write @test on my cshtml page it gives me parse error

CS0103: The name 'test' does not exist in the current context

How do I escape '@' character?


@@应该这样做。


Razor @ escape char to symbols...

<img src="..." alt="Find me on twitter as @("@username")" />

or

<img src="..." alt="Find me on twitter as @("@")username" />

使用<text></text>或更简单的方法@:

链接地址: http://www.djcxy.com/p/60710.html

上一篇: 如何使XmlDocument尊重HTML转义序列

下一篇: 在剃刀视图引擎中逃离@角色