This is because Convert.ToInt32 is a method call that takes a string.
(int) is an explicit conversion from one type to another. String and Int32 are not explicitly and implicitly convertible.
Addition on conversion: You can create your own implicit and explicit conversion, for example:
class Foo { bool b = (bool)new Blah(); struct Blah { public static explicit operator bool(Blah b) { return true; } } }
I kept my example very simple (and useless), but it should clearly indicate that only if the operator exists in the class or structure to be converted, a simple conversion is possible. Otherwise, you will need to use the Convert class or the IConvertible interface.
source share