我是有点困惑与使用@。在下面的code我第一次写 Html.ActionLink(...)
,而不是 @ Html.ActionLink(...),因为我是在一个
如果
块(C#code)。所以,我想确切地了解什么时候我必须使用@当我不都使用它。
I'm a little bit confused with the use of @. In the following code I first wrote Html.ActionLink(...)
instead of @Html.ActionLink(...)
because I was in a if
block (C# code). So, I would like to understand exactly when I do have to use @ and when I don´t have to use it.
<td width="32%" align="center">
@if (Model.SeccionImpresos != null)
{
@Html.ActionLink("IMPRESOS", "Index", "Trabajo", null, null, "#impresos", new { id = Model.Id }, null);
}
</td>
我AP preaciate有这方面的帮助。
I appreaciate any help on this.
@
有两种用途:
它用于启动code的块的( It's used to start a code block ( 它用于code的掘金的&ndash的;这是写入到输出流EX pressions( It's used for code nuggets – expressions which are written to the output stream ( 写 Writing @if
, @foreach ,@ {...}等))
@if
, @foreach
, @{ ... }, etc) from a markup context (as opposed to from another code block)
@ EX pression
)。@expression
). Html.ActionLink
没有 @
在code块创建正常的方法调用放弃其的结果。Html.ActionLink
without @
in a code block creates a normal method call that discards its result.