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

前端 未结 2 1343
傲寒
傲寒 2020-12-06 16:47

I recently upgraded my website from ASP.NET MVC3 (Razor) to MVC4 (Razor2), and in doing so found what seemed like a breaking change in the Razor view engine.

The sce

2条回答
  •  半阙折子戏
    2020-12-06 17:13

    Seems like a bug. It works with String:

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

提交回复
热议问题