Defines methods that convert the value of the implementing reference or value type to a common language runtime type that has an equivalent value.
The IConvertible type is not CLS-compliant. For more information about CLS compliance, see What is the Common Language Specification.
For a list of all members of this type, see IConvertible Members.
[Visual Basic] <CLSCompliant(False)> Public Interface IConvertible [C#] [CLSCompliant(false)] public interface IConvertible [C++] [CLSCompliant(false)] public __gc __interface IConvertible [JScript] public CLSCompliant(false) interface IConvertible
Classes that Implement IConvertible
|DBNull||Represents a null value.|
|Enum||Provides the base class for enumerations.|
|String||Represents text; that is, a series of Unicode characters.|
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.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
Assembly: Mscorlib (in Mscorlib.dll)