这样看是不是会清楚些:
if(sort.ParentPath == "")
{
text1 = "select max(orderID) from aclass ";
}
else
{
text1 = "select max(orderID) from aclass " +string.Concat((textArray1 = new string[5]));
}
if(sort.ParentPath == "")
{
text1 = "select max(orderID) from aclass ";
}
else
{
text1 = "select max(orderID) from aclass " +string.Concat((textArray1 = new string[5]));
}
<test>?<result_true>:<resutl_false>
根据<test>值的真假返回<result_true>或<resutl_false>中的一个值,此比较可以用if代替,且可读性更好。
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/csspec/html/vclrfcsharpspec_7_12.htm?: 运算符称为条件运算符。有时,它也称为三元运算符。