剃刀保留字 [英] Razor reseverd words

查看:38
本文介绍了剃刀保留字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

剃刀语法很简洁,没有什么可争论的.但我似乎在任何地方都找不到它...
什么是剃刀保留字?
@使用
@继承
@函数
@节
你还认识其他人吗?

That the razor syntax is neat, there's little arguing about. But i can't seem to find it anywhere...
What are the razor reserved words?
@using
@inherits
@functions
@section
Do you know any other?

推荐答案

这里是 Razor 保留关键字列表(注意:这适用于 cshtml,vbhtml 遵循 VB 的规则):

Here's a list of Razor reserved keywords (Note: This applies to cshtml, vbhtml follows VB's rules):

  • 继承
  • 功能
  • 部分
  • 帮手
  • 模型(仅在 MVC 项目中)

您可以使用 @(inherits)

这些是 Razor 理解的 C# 关键字

These are C# keywords that are understood by Razor

  • 如果
  • 试试
  • 为了
  • foreach
  • 同时
  • 切换
  • 锁定
  • 使用
  • 案例
  • 默认

您可以使用 @(@lock) 转义它们(第一个 @ 用于转义 Razor 解析器,第二个 @ 用于转义转义 C# 解析器)

You can escape them using @(@lock) (first @ is used to escape the Razor parser and the second @ is used to escape the C# parser)

这些不是在 RC 中保留的,而是用于 RTM.更新:这些将没有 RTM 功能.它们只是保留供将来使用.

These are not reserved in RC but will be for RTM. Update: These will have no functionality for RTM. They are simply reserved for future use.

  • 命名空间
  • 班级
  • 布局

这篇关于剃刀保留字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆