Razor Syntax

Razor Syntax
  • New, Simplified View Engine
  • Write fewer lines of code
  • More natural mix code and markup
  • Helpers save you time
  • Compatible with ASP.NET Web Pages in WebMatrix
<ul>
  @for (int i = 0; i < 10; i++) {
    <li>@i</li>
  }
</ul>

Move from code to markup easily with Razor

@{
   var name = "Hello razor";
   @: Your name: @name
}

Commenting in Razor

@*
  @{ 
    var name = "Hello razor";
    @name
  }
*@
Razor Syntax Razor Syntax Reviewed by Bhaumik Patel on 7:51 PM Rating: 5