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

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -