IConvertibleCF 1.0

System (mscorlib.dll)interface

The IConvertible interface allows conversion of an object to basic data types and allows the conversion methods in the Convert class to use that object. When implementing the IConvertible interface, create your own type-specific methods for each of the supplied conversion methods.

Note that IConvertible allows one-way conversion from a custom type to other data types, but does not allow a conversion from a basic data type to a custom type.

public interface IConvertible {
// Public Instance Methods
   public TypeCode GetTypeCode( );
   public bool ToBoolean(IFormatProvider provider);
   public byte ToByte(IFormatProvider provider);
   public char ToChar(IFormatProvider provider);
   public DateTime ToDateTime(IFormatProvider provider);
   public decimal ToDecimal(IFormatProvider provider);
   public double ToDouble(IFormatProvider provider);
   public short ToInt16(IFormatProvider provider);
   public int ToInt32(IFormatProvider provider);
   public long ToInt64(IFormatProvider provider);
   public sbyte ToSByte(IFormatProvider provider);
   public float ToSingle(IFormatProvider provider);
   public string ToString(IFormatProvider provider);
   public object ToType(Type conversionType,  IFormatProvider provider);
   public ushort ToUInt16(IFormatProvider provider);
   public uint ToUInt32(IFormatProvider provider);
   public ulong ToUInt64(IFormatProvider provider);

Implemented By

Multiple types

    Part II: Programming with the .NET Framework
    Part IV: API Quick Reference
    Chapter 26. System