The Convert
class has been in existence since .NET 1.0. The IConvertible
interface has also existed since this time.
The Convert.ChangeType
method only works on objects of types that implement IConvertible
(in fact, unless I'm mistaken, all of the conversion methods provided by the Convert
class are this way). So why is the parameter type object
?
In other words, instead of this:
public object ChangeType(object value, Type conversionType);
Why isn't the signature this?
public object ChangeType(IConvertible value, Type conversionType);
Just seems strange to me.