【发布时间】:2021-03-10 10:44:55
【问题描述】:
我在 ASP.NET Core Razor 视图上有以下表达式:
<a href="@(Options.CurrentValue.Applications.First(x => x.Name == "Spa").Url)">
当我构建它时,我得到了错误:
A space or line break was encountered after the "@" character. Only valid identifiers, keywords, comments, "(" and "{" are valid at the start of a code block and they must occur immediately following "@" with no space in between.
我在 @ 之后添加了括号,因为我的代码中有双引号。
如何解决?
【问题讨论】:
-
我看不出这段代码有什么问题。
@后面没有换行符或空格。那里可能有不可打印的字符吗?
标签: asp.net-core razor