var condition = false;
Foo($"String is {(condition ? "True" : "False")} works");
但
Foo($"String is {(condition ? "True"
: "False")} fails");
当我在字符串插值语句中很好地格式化条件运算符时,我遇到了编译错误?
答案 0 :(得分:0)
使用@
Foo($@"String is {(condition ? "True"
: "False")} fails");