This topic has not yet been rated - Rate this topic

Convert.ChangeType Method

Returns an object of a specified type whose value is equivalent to a specified object.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  Name Description
Public method Static member ChangeType(Object, Type) Returns an object of the specified type and whose value is equivalent to the specified object.
Public method Static member ChangeType(Object, TypeCode) Returns an object of the specified type whose value is equivalent to the specified object.
Public method Static member ChangeType(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.
Public method Static member ChangeType(Object, TypeCode, IFormatProvider) Returns an object of the specified type whose value is equivalent to the specified object. A parameter supplies culture-specific formatting information.
Top
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Scope of general Type conversion

The reader must understand that Convert.ChangeType() works only for certain, standard .NET system types.  It does not work for any component that does not implement IConvertible, and it does not work for custom types.

For an overview of the scope of general Type conversion, including a specific set of guidelines, principles, and web links that illustrate how to solve the problem in a broader, more useful, and generalized manner, please refer to the following link:

http://stackoverflow.com/questions/312858/how-can-i-convert-types-at-runtime/7942350#7942350