Question

In ASP.NET 4.0

should I use new syntax <%: expression %> or 2.0 <%= HttpUtility.HtmlEncode(expression) %>

Was it helpful?

Solution

Less keystrokes, less chance to make a mistake, easier to read => use the first option.

OTHER TIPS

That's sort of like asking if you should do this:

<%= DateTime.Now %>

or this

<% Response.Write(DateTime.Now) %>

There's no right answer, but one certainly looks better to me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top