现在的位置: 首页 > 综合 > 正文

Hello,ASP.NET World

2012年03月25日 ⁄ 综合 ⁄ 共 572字 ⁄ 字号 评论关闭
Code enclosed by <% ... %> is just executed, while expressions that include an equal sign, <%= ... %>, are evaluated and the result is emitted as content. Therefore <%="Hello World" %> renders the same thing as the C# code <% Response.Write("Hello World"); %>.

Note: For languages that use marks to end or separate statements (for example, the semicolon (;) in C#), it is important to place those marks correctly depending on how your code should be rendered.

C# code
<% Response.Write("Hello World"); %> A semicolon is necessary to end the statement.
<%="Hello World"; %> Wrong: Would result in "Response.Write("Hello World";);".
<%="Hello World" %> A semicolon is not necessary.

抱歉!评论已关闭.