ConvertChangeType Method (Object, Type) |
Returns an object of the specified type and whose value is equivalent to the specified object.
Namespace: SystemAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public static Object ChangeType(
Object value,
Type conversionType
)
Parameters
- value
- Type: SystemObject
An object that implements the IConvertible interface. - conversionType
- Type: SystemType
The type of object to return.
Return Value
Type:
ObjectAn object whose type is
conversionType and whose value is equivalent to
value.-or-A null reference (Nothing in Visual Basic), if
value is null and
conversionType is not a value type.
Exceptions Exception | Condition |
---|
InvalidCastException | This conversion is not supported. -or-value is null and conversionType is a value type.-or-value does not implement the IConvertible interface. |
FormatException | value is not in a format recognized by conversionType. |
OverflowException | value represents a number that is out of the range of conversionType. |
ArgumentNullException | conversionType is null. |
See Also