I have InvalidCastException when I try to cast 0.0 to double, why is that so? It\'s fine when I do (float)value instead.
InvalidCastException
(float)value
The float has been boxed as an object. So you're trying to convert a boxed float into a double. Use Vyas's convert instead - it is far more flexible and should always do the right thing:
var val=Convert.ToDouble(value);