Simply curious, MSDN says that
Calling this method always throws InvalidCastException.
So why does this overload exist in the framework? Is it following some sort of pattern? I would assume for backwards compatibility it would be better to remove the overload and receive compile errors rather than run-time exceptions. I don't remember if this method was actually supported in previous frameworks though.
ToInt32(String, IFormatProvider) Converts the specified string representation of a number to an equivalent 32-bit signed integer, using the specified culture-specific formatting information. ToInt32(String, Int32) Converts the string representation of a number in a specified base to an equivalent 32-bit signed integer.
Convert. ToInt32 allows null value, it doesn't throw any errors Int.
As you can see in the documentation in the link you provided:
Remarks
This method is reserved for future use.
They simply haven't found an implementation they are happy with or is necessary, but they are planning for it to be so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With