Reputation: 19664
I am seeing some examples online where the @
is being used before server side code.
eg
<h2>Browsing Genre: @Model.Name</h2>
So can you just use a single @
instead of wrapping the c#/vb code in <% %>
?
Upvotes: 0
Views: 102
Reputation: 30152
This is indeed razor syntax from MVC 3. Here is the syntax comparisons side by side http://haacked.com/archive/2011/01/06/razor-syntax-quick-reference.aspx
Note @ html encodes everything by default unless whatever after the @ returns an MvcHtmlString. <% %> in web forms did not html encode, but <%: %> syntax does.
Upvotes: 2
Reputation: 78840
You can use @
if you're using the Razor view engine in ASP.NET MVC. That's most-likely what you're seeing examples of.
Upvotes: 8