"NotYetaNurd" wrote:
Please help me with the following snippet
float withdrawal=(objgetWithdrawal is float)? (float)objgetWithdrawal :0;
float expence= (objgetSpending is float)? (float)objgetSpending :0;
lblBal.Text="Current Balance = Rs." +
(withdrawal-expence) > 0.0F? //here i am getting the error "Operator '>'
cannot be applied to operands of type 'string' and 'float'"
(withdrawal-expence).ToString():"Error Check DB";
put () around the whole thing might solve it
( (withdrawal-expence) > 0.0F? (withdrawal-expence).ToString():"Error Check DB" )
I think as a good practice, you should really stop cramming so much into a single line. it's bad for readability, a maintainence nightmare months down the line and likely to be buggie. for example, sometimes (when you don't have the right grouping), implicit conversions could cause lines like this to evaluate to something very different from your original intension without generating errors. this is definitely not the right way to obfuscate code.