The sintaxe for ?:
Ternary is:
object result = bool ? object : object;
In your code, you did not define anything after the :
scope, to use like this, you could define another ternary scope after the :
and apply it again, something like:
statusCode = statusCode == "1" ? productStatusItemAvailable1 :
statusCode == "2" ? productStatusItemOutOfStock1 :
statusCode == "3" ? productStatusItemAvailableOnRemoteDate1 :
statusCode == "4" ? productStatusAlternativeItemAvailable1 :
statusCode == "5" ? productStatusItemSoldOutAndOurSuppliersHaveNoAvailable :
statusCode == "6" ? productStatusItemSoldOutContactCustomerService1
: stirng.Empty;
The last :
scope of ternary, is like the last else
statment of an if
structure. you have to define a value as a default
value for it, because it is part of the structure of ternary operator.