开发者

Razor if condition difference

Why is the second if statement incorrect? note that I attempted to make it a single line.

Razor if condition difference

Razor if condition difference

thanks

After Andrei Andrushkevich suggestion, red code. Tree and ul are red/squiggled. Plus the function param is red an开发者_如何学编程d all references in the blurred code is red.

Razor if condition difference


The @: sequence indicates that the entire line of content that follows should be treated as a content block.

So @if (condition) { @: Some content } won't work because the last bracket is interpreted as content and another ending } will be expected.

For single line conditions you can use the <text> tag:

@if (condition) { <text>Some content</text> }


Remove first symbol "@" from the second condition.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜