Why Convert.ToInt32 Might be Dangerous

Posted on March 19, 2008 | 6 Comments

Casting float to int is interesting. Not only it causes the value to get truncated, but it also changes binary representation. When you want to cast float to int you have two options:

1) If you came from c/c++, there are several ways to do cast operations but the natural thing would be to use (int).

2) You can also use the Convert class to do the job (C#).

Check this Continue reading...