How to use generic syntax inside a Razor view file?

后端 未结 5 1624
遥遥无期
遥遥无期 2021-02-04 23:26

I was trying to use the following statement:

@Html.Test().Nand()

However, Razor is choking at the < before the ISQL.

Any

5条回答
  •  梦谈多话
    2021-02-04 23:36

    It's about the @ character, this example works before upgrade

    @{
        string @class = ViewBag.@class;
        IDictionary htmlAttributes = new Dictionary();
    }
    

    After upgrade, it must be separated into two blocks

    @{  string @class = ViewBag.@class; }
    @{  IDictionary attrs = new Dictionary(); }
    

提交回复
热议问题