Possible breaking change in MVC4 Razor that can be fixed with “@:@”

故事扮演 提交于 2019-11-28 00:44:52

Seems like a bug. It works with String:

@foreach (var x in Model)
{
    @String.Format("Foo bar: {0}", x)
}

This is indeed a bug we decided not to fix, note that the syntax is incorrect as there is no transition between C# and markup in this case.

I understand that resharper shows a warning here but I believe the warning is wrong.

Here is the bug for future reference https://aspnetwebstack.codeplex.com/workitem/458

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!