Defines methods that convert the value of the implementing reference or value type to a common language runtime type that has an equivalent value.
See Also: IConvertible Members
This interface provides methods to convert the value of an instance of an implementing type to a common language runtime type that has an equivalent value. The common language runtime types are bool, sbyte, byte, short, ushort, int, uint, long, ulong, float, double, decimal, DateTime, char, and string.
If there is no meaningful conversion to a common language runtime type, then a particular interface method implementation throws InvalidCastException. For example, if this interface is implemented on a Boolean type, the implementation of the IConvertible.ToDateTime(IFormatProvider) method throws an exception because there is no meaningful DateTime equivalent to a Boolean type.
The common language runtime typically exposes the IConvertible interface through the Convert class. The common language runtime also uses the IConvertible interface internally, in explicit interface implementations, to simplify the code used to support conversions in the Convert class and basic common language runtime types.
In addition to the IConvertible interface, the .NET Framework provides classes called type converters for converting user-defined data types to other data types. For more information, see the Generalized Type Conversion topic.