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 Boolean, SByte, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Single, 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 ToDateTime 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.
Notes to Implementers: If you implement the IConvertible interface, your implementation will be called automatically by the Convert..::.ChangeType(Object, Type) method if the Object parameter is an instance of your implementing type and the Type parameter is a common language runtime type.
Most conversion methods have a parameter of type IFormatProvider. Most commonly, this parameter represents either the current culture (CultureInfo..::.CurrentCulture) or a specific culture. Generally, the IConvertible implementations of the base types ignore this parameter. However, you can choose whether to use it in your code.