asp.netasp.net-mvcrazorescaping

Escape the @ character in the Razor view engine


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

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

How do I escape the '@' character?


Solution

  • @@ should do it.