G
GS
Can somebody explain why first part works and second part does not? Second operator throws error below
Error 52 Type of conditional expression cannot be determined because there is no implicit conversion between '<null>' and 'double'
if (myItem.BuyItNowPrice == null)
{
myRow["Buy It Now Price"] = null;
}
else
{
myRow["Buy It Now Price"] = myItem.BuyItNowPrice.Value;
}
myRow["Buy It Now Price"] = (myItem.BuyItNowPrice == null) ? null : myItem.BuyItNowPrice.Value; <-- Does not work
Error 52 Type of conditional expression cannot be determined because there is no implicit conversion between '<null>' and 'double'
if (myItem.BuyItNowPrice == null)
{
myRow["Buy It Now Price"] = null;
}
else
{
myRow["Buy It Now Price"] = myItem.BuyItNowPrice.Value;
}
myRow["Buy It Now Price"] = (myItem.BuyItNowPrice == null) ? null : myItem.BuyItNowPrice.Value; <-- Does not work