var discount = (i == 1) ? definition.SecondPetDiscount ?? definition.AdditionalPetDiscount :
               (i == 2) ? definition.ThirdPetDiscount ?? definition.AdditionalPetDiscount :
               definition.AdditionalPetDiscount;
Could you any one give me an explanation of this code snippet? I know about the ternary operator. But the above is not like that.
The normal ternary operator looks like this:
PaidDate = ( paidDate == null ? DateTime.Now : paidDate);

DateTime? paidDate = null; var date = paidDate ?? DateTime.Now;You can interpret it as "if paidDate is not null, then return its value, otherwise return DateTime.Now. Notice that the first argument needs to be Nullable, in this caseDateTime???has higher precedence than the conditional operator? :.