August 2003
Intermediate to advanced
928 pages
32h 1m
English
IConvertible
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(IFormatProviderprovider); public byte ToByte(IFormatProviderprovider); public char ToChar(IFormatProviderprovider); public DateTime ToDateTime(IFormatProviderprovider); public decimal ToDecimal(IFormatProviderprovider); public double ToDouble(IFormatProviderprovider); public short ToInt16(IFormatProviderprovider); public int ToInt32(IFormatProviderprovider); public long ToInt64(IFormatProviderprovider); public sbyte ToSByte(IFormatProviderprovider); public float ToSingle(IFormatProviderprovider); public string ToString(IFormatProviderprovider); public object ToType(TypeconversionType, IFormatProviderprovider); public ushort ToUInt16(IFormatProviderprovider); public uint ToUInt32(IFormatProviderprovider); public ulong ToUInt64(IFormatProviderprovider); }
Multiple types