I am creating a sample ASP.NET MVC 3 site using Razor as view engine. The razor syntax starts with @
character e.g. @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?
this work for me
Or yoy can use: @@Alan_van_Buuren
:D
For the question about
@RazorCodePart1 @@ @RazorCodePart2
, you need to the sequence:I know, it looks a bit odd, but it works and will get you the literal character '@' between the code blocks.