Explain about Razor View Engine ?

 Posted by Bharathi Cherukuri on 8/27/2012 | Category: ASP.NET MVC Interview questions | Views: 6632 | Points: 40
Answer:

This Razor View engine is a part of new rendering framework for ASP.NET web pages.
ASP.NET rendering engine uses opening and closing brackets to denote code (<% %>), whereas Razor allows a cleaner, implied syntax for determining where code blocks start and end.

Example:

In the classic renderer in ASP.NET:

<ul>
<% foreach (var userTicket in Model)
{ %>
<li><%: userTicket.Value %></li>
<% } %>
</ul>


By using Razor:

<ul>

@foreach (var userTicket in Model)
{
<li>@userTicket.Value</li>
}
</ul>


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response