string separator = " > ";
string retStr = "";
int count = 0;
foreach (string s in retList)
{
count++;
if(!string.IsNullOrEmpty(s))
{
if (count < retList.Count)
retStr += s + separator;
else
retStr += s;
//count < retList.Count ? retStr += s + separator : retStr += s;
}
}
注释掉的行导致错误:Only assignment, call, increment, decrement, and new object expressions can be used as a statement
。这不应该等同于上面的 if-case 吗?