Feature 'interpolated strings' is not available in C# 5. Please use language version 6 or greater.

后端 未结 3 1365
南笙
南笙 2021-01-17 14:29

The following line does not compile when I put in a Razor View.

var extPropLookupNameCompania = $\"extension_{SettingsHelper.ClientId.Replace(\"-\", \"\")}_{         


        
3条回答
  •  长发绾君心
    2021-01-17 15:29

    You have to encapsulate it with braces like this:

    EDIT: I updated because there was a missing curly.

    var extPropLookupNameCompania = $("{extension_{SettingsHelper.ClientId.Replace("-", "")}_{"Compania"}");
    

    I tried the following successfully:

     @($"It is {DateTime.Now}")
    

提交回复
热议问题