Type conversions and casting in C# are so whack! Microsoft created the System.Convert class to bring some sanity and predictability to converting from one type to another in C#. Without further ado, to convert a Double to an Integer, you can use: int myInt = System.Convert.ToInt32(myDouble);
The System.Convert class has the following methods:
- and some more….