.NET" code块的块与QUOT;?NET、QUOT、code

2023-09-02 21:30:53 作者:少年未老爱已凉、

因此​​,在.NET中,我们有...

So in .NET we have...

<%=

<%: (new to .NET 4 - syntactic sugar for HTML encoding)

<%#

<%@

究竟是这些么?

What exactly are these?

和有没有更多?是否有这些详尽的清单,它们是什么,哪儿了吗?很难知道什么,甚至搜索 - 我甚至没有听到code狗头块'直到今晚,当我发现了什么&LT的;%:是

And are there more? Is there an exhaustive list of these and what they are anywhere? It's hard to know what to even search for - I didn't even hear of the term "code nugget blocks" 'til tonight when I discovered what <%: was.

推荐答案

这些&LT;%@ 的指令。对于一个详尽的列表和文档见 MSDN 。

These <%@ are directives. For an exhaustive list and documentation see MSDN.

在使用时,指令可以在.aspx或的.ascx位于任何地方   文件,虽然标准的做法是将它们包括之初   文件。每个指令可以包含一个或多个属性(配对   同的值)的特定于该指令

When used, directives can be located anywhere in an .aspx or .ascx file, though standard practice is to include them at the beginning of the file. Each directive can contain one or more attributes (paired with values) that are specific to that directive.

&LT;%的脚本块。这里是 MSDN

这是嵌code块服务器$ C,在页面的执行$ C   呈现阶段。在code块中的可执行程序   报表功能和通话功能在当前页类。

An embedded code block is server code that executes during the page's render phase. The code in the block can execute programming statements and call functions in the current page class.

&LT;%#块通常用于绑定的控件。看到这个短文章更多信息。

The <%# block is used normally in bound controls. See this short article for more info.