Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 ASP.NET 4.0 中
我应该使用新语法<%: expression %>还是 2.0<%= HttpUtility.HtmlEncode(expression) %>
<%: expression %>
<%= HttpUtility.HtmlEncode(expression) %>
更少的击键,更少的出错机会,更容易阅读 => 使用第一个选项。
这有点像问你是否应该这样做:
<%= DateTime.Now %>
或这个
<% Response.Write(DateTime.Now) %>
没有正确的答案,但对我来说肯定更好看。