Show Menu
Cheatography

Microsoft Razor Cheat Sheet (DRAFT) by

Microsoft ASP.NET MVC Razor View Engine Cheat Sheet

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Code Nuggets

Must return object
@Objec­t.M­ethod()
Explicit notation
@( code nugget here )

Code Blocks

Denotes sections of code without the requir­ement of a return object
@{ code block here }

Content Markup

Used in code block to denote a content sequence to render
@:
alternate method
<te­xt> render this </t­ext>

Comments

Can be used for line, multi-line or entire section
@ ...comment or code... @

Layout Pages

Denotes Body
@Rende­rBody()
Denotes Sections
@Rende­rSe­ction( [section] )