Click or drag to resize
ConvertChangeType Method (Object, Type, IFormatProvider)
Returns an object of the specified type whose value is equivalent to the specified object. A parameter supplies culture-specific formatting information.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static Object ChangeType(
	Object value,
	Type conversionType,
	IFormatProvider provider
)

Parameters

value
Type: SystemObject
An object that implements the IConvertible interface.
conversionType
Type: SystemType
The type of object to return.
provider
Type: SystemIFormatProvider
An object that supplies culture-specific formatting information.

Return Value

Type: Object
An object whose type is conversionType and whose value is equivalent to value.-or- value, if the Type of value and conversionType are equal.-or- A null reference (Nothing in Visual Basic), if value is null and conversionType is not a value type.
Exceptions
ExceptionCondition
InvalidCastExceptionThis conversion is not supported. -or-value is null and conversionType is a value type.-or-value does not implement the IConvertible interface.
FormatExceptionvalue is not in a format for conversionType recognized by provider.
OverflowExceptionvalue represents a number that is out of the range of conversionType.
ArgumentNullExceptionconversionType is null.
See Also