在剃刀视图引擎中转义 @ 字符 [英] Escape @ character in razor view engine
本文介绍了在剃刀视图引擎中转义 @ 字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个示例 ASP.NET MVC 3 站点,使用 Razor 作为视图引擎.razor 语法以 @
字符开头,例如@RenderBody()
.如果我在我的 cshtml 页面上写 @test 它会给我解析错误
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:当前上下文中不存在名称test"
CS0103: The name 'test' does not exist in the current context
如何转义@"字符?
推荐答案
@@
应该这样做.
这篇关于在剃刀视图引擎中转义 @ 字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文