Answer:
-When we need to include our c# or VB code with the HTML markup within ASP.NET Web pages then sometimes it becomes very tedious. To overcome this problem, Razor was implemented.
-Razor was introduced with ASP.NET MVC 3 to make ease of writing C# or VB code in HTML pages.
-There is no need to use ASP.NET delimiter <%= %>. We can use only “@” character to achieve the same goal.
-For example
<%= DateTime.Now %>
Can be written in Razor simply as
@DateTime.Now
-In razor all syntax starts with “@” and if there is only one line of code then there is no need to use “{“.
-The extension of Razor file is cshtml for C# work environment and vbhtml for Visual Basic work environment.
-Razor was introduced with ASP.NET MVC 3 to make ease of writing C# or VB code in HTML pages.
-There is no need to use ASP.NET delimiter <%= %>. We can use only “@” character to achieve the same goal.
-For example
<%= DateTime.Now %>
Can be written in Razor simply as
@DateTime.Now
-In razor all syntax starts with “@” and if there is only one line of code then there is no need to use “{“.
-The extension of Razor file is cshtml for C# work environment and vbhtml for Visual Basic work environment.
Previous Question | Next Question |
Explain the main function of Razor in ASP.NET? | Explain a program using code nuggets to create a simple application? |