if statement - C# tertiary if operator giving issue with nullable double -
i have nullable double
mynullabledouble = mydouble == 0 ? null : mydouble;
this causing me issue :
type of conditional expression cannot determined because there no implicit conversion between '' , 'double'
you should cast mydouble
, otherwise on left side have type double?
while in right part have double
, types not equivalent (and that's exception saying):
mynullabledouble = mydouble == 0 ? null : (double?)mydouble;
Comments
Post a Comment