Error CS0266 Cannot implicitly convert type 'double' to 'int'. An explicit conversion exists (are you missing a cast?)

Hi

I am experiencing the above error when trying to assign a double to an integer, is anyone able to help please?


Thanks

Raychel

Hi @raychel.hall

Give a try

Cint(JaccardIndex)

@raychel.hall , try Cint(JaccardIndex)

HI,

How about the following expression?

IntHighestResult1 = (Int32)JaccardIndex

Regards,

Thanks Yoichi :slight_smile:

1 Like

@vishal.kp Thanks for your response, apologies, I should have said I had already tried that.

1 Like

Hi @Yoichi

When I saved the double to an int32 the value changed from 83.72 to 83.00, is there anyway I can keep the value the same?

Thanks

Raychel

Hi,

Int32 type cannot have decimal point. If you need to keep Double type value as it is, please consider to use Double type instead of Int32.

Regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.