【发布时间】:2017-06-05 08:58:52
【问题描述】:
以下 C# 表达式导致我的程序出现编译器错误:
$"Getting image from {location.IsLatitudeLongitude ? $"{location.Latitude} - {location.Longitude}" : location.Location}."
不应该像那样使用字符串插值吗?还是不能这样做?
【问题讨论】:
-
在字符串插值中使用三元运算符有点棘手:我认为您必须添加圆括号。
标签: c# string-interpolation csc