我想将JSON文件的名称分配给变量:
string environment =
#if DEBUG
"appsettings.Development.json";
#else
"appsettings.json";
错误是:}预期
答案 0 :(得分:1)
如果您遗失了#endif
(问题中遗漏了),则会显示此错误:
string environment =
#if DEBUG
"appsettings.Development.json";
#else
"appsettings.json";
#endif