- value
- An object that implements the IConvertible interface.
- typeCode
- The type of object to return.
An object whose underlying type is typeCode and whose value is equivalent to value.
-or-
A null reference (Nothing in Visual Basic), if value is null and typeCode is TypeCode.Empty, TypeCode.String, or TypeCode.Object.
Convert.ChangeType(object, TypeCode) is a general-purpose conversion method that converts the object specified by value to a predefined type specified by typeCode. The value parameter can be an object of any type. For the conversion to succeed, value must implement the IConvertible interface, because the method simply wraps a call to an appropriate IConvertible method. The method also requires that conversion of value to typeCode be supported.
The Convert.ChangeType(object, TypeCode) method does not support the conversion of value to a custom type. To perform such a conversion, call the Convert.ChangeType(object, Type) method.